[darcs-users] escapes and locales support for darcs 1.0

David Roundy droundy at abridgegame.org
Sun Aug 15 11:32:06 UTC 2004


On Sun, Aug 15, 2004 at 01:25:51PM +0200, Martin Sjgren wrote:
> On Sun, 15 Aug 2004 06:53:56 -0400, David Roundy
> <droundy at abridgegame.org> wrote:
> > On Sat, Aug 14, 2004 at 02:30:53PM +0200, Tommy Pettersson wrote:
> > ....
> > > It will not work, and possibly be bad, with other than these locales.  So
> > > I wanted to make it run-time conditional with an environment variable:
> > > DARC_USE_ISPRINT or DARCS_8BIT_LOCALE or such, the same way
> > > DARCS_SLOPPY_LOCKS works.  But I don't know how to code that in Haskell.
> > > getEnv returns IO and escape is pure functional and I want a Bool.
> > 
> > This is a good opportunity for unsafePerformIO to be used safely.  You can
> > create a wrapper "pure" function:
> > 
> > trustIsPrint :: Bool
> > trustIsPrint =
> >   do foo <- unsafePerformIO
> >             (getEnv "DARCS_USE_ISPRINT" `catch` \_ -> return "0")
> >      return $ foo /= "0"
> 
> I think you mean
> 
> trustIsPrint = unsafePerformIO $ do
>   foo <- getEnv "DARCS_USE_ISPRINT" `catch` \_ -> return "0")
>   return $ foo /= "0"
> 
> :)

Yep, except I would have wante an open parenthesis to match the close
parenthesis...

:p
-- 
David Roundy
http://www.abridgegame.org




More information about the darcs-users mailing list