Re: re-opening a closed stdin?

2002-11-25 Thread Albert Lai
"Simon Marlow" <[EMAIL PROTECTED]> writes: > It is nice, but it introduces too many problems. What happens to any > I/O errors encountered by the lazy I/O? They have to be discarded, > which means you can't effectively use lazy I/O for robust applications > anyway. Damn, I forgot that "file" me

Re: re-opening a closed stdin?

2002-11-22 Thread Albert Lai
"Simon Marlow" <[EMAIL PROTECTED]> writes: > One reason, I think, is lazy I/O(*). It's to stop you accidentally [...] > (*) kill it! die! die! So you want main = readFile "/dev/zero" >> return () to terminate violantly rather than terminate peacefully? :) Seriously, I understand that the IO

Re: Optimisation and unsafePerformIO

2002-10-29 Thread Albert Lai
"David Sabel" <[EMAIL PROTECTED]> writes: > {-# NOINLINE b #-} > > b x = if even x then unsafePerformIO getChar else bot > > bot = bot > > main = do > putChar (b 4) > putChar (b 6) I am not a compiler implementer (or lawyer, for that matter :) But I propose this guess. Firs

Re: Docs missing?

2002-07-24 Thread Albert Lai
The doc RPM package for Red Hat 7.3 suffers the same problem as the SuSE one. Could someone please give a hand-holding guide so that we can fix it ourselves? Please? Please? ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.o

Double your monad in 30 days

2002-03-05 Thread Albert Lai
Ashley Yakeley <[EMAIL PROTECTED]> writes: > Prelude> 0 * 2 > 0 We can generalize this. import Monad double_your_monad_in_30_days :: (MonadPlus M) => M a double_your_monad_in_30_days = mzero `mplus` mzero ___ Glasgow-haskell-users mailing list [EMAI

Re: i368-pc-os2-emx port

2002-02-20 Thread Albert Lai
"Simon Marlow" <[EMAIL PROTECTED]> writes: > On the other hand, you'd need something like mingw for OS/2 - does > such a beast exist? The substring "emx" refers to an OS/2 version of gcc and libraries that make OS/2 look really like Unix from the programmer's point of view. (It probably even pr

Re: Congrats to Mandrake

2002-02-20 Thread Albert Lai
[EMAIL PROTECTED] (Ketil Z. Malde) writes: > I'm not sure what the point would be, if they are in the > distributions anyway? Isn't it better to install them by apt-get or > up2date or whatever? (In fact, I had almost thought manually > downloading packages a thing of the past, but then the IT

Re: Instances of IArray

2002-02-15 Thread Albert Lai
I had looked into the source code of IArray a bit. Like you have found, (!) is not a class method. In fact, none of the claimed class methods in the doc is a class method, and no class method of IArray is documented. Instead, IArray class methods seem to pertain to implementation details (I mea

Re: State Transformer

2002-01-11 Thread Albert Lai
Theodore Norvell <[EMAIL PROTECTED]> writes: > Jorge's question raised a question in my mind. The IOExts > module has many of the same features as the ST module, why > are there two ways to do the same thing? Is the ST module > only there for legacy purposes? My user view is that I appreciate

Re: State Transformer

2002-01-11 Thread Albert Lai
> > testfunc = do > >r <- newSTRef ('x',0) > >foo r > >bar r > >(c,n) <- readSTRef r > >return n Jorge Adriano <[EMAIL PROTECTED]> writes: > Yeap, I could do it like this myself :) > The whole problem is with passing the 'r' as a parame

Re: State Transformer

2002-01-07 Thread Albert Lai
I will just translate your example from Norvell's DIY state monad to GHC's ST monad. As you noticed, GHC's ST monad begins with an "empty" state and you use some commands to add state variables as you go. This means the translation is not straightforward. I hope you still get the gist of it. Yo

Re: ghc image size

2001-12-17 Thread Albert Lai
Mike Gunter <[EMAIL PROTECTED]> writes: > Why is executable size a barrier? 1.64 megabytes (that's the size of > the executable I built with GHC most recently) of disk space costs less > than half a cent. I don't like this argument. Can I go to a computer store, pay a cent, and get a hard disk

Re: Working character by character in Haskell

2001-10-18 Thread Albert Lai
"Andre W B Furtado" <[EMAIL PROTECTED]> writes: [...] > For example, suppose function doSomeStuffWith returns its own parameter. > Using a 1.5MB file in this case, the Haskell program ends in almost 5 > seconds, while the C program ends in less than 0.5 seconds... Is my Haskell > program too bad

Re: Student Programming Projects

2001-09-20 Thread Albert Lai
Consider goal-directed theorem prover (or proof checker). Two existing samples are in Lawrence Paulson's ML for the Working Programmer, and yours truly's http://www.cs.utoronto.ca/~trebla/fp/prover/index.html The advantage of mine is it illustrates monads. The advantage of Paulson's is it doesn

Confused about enabling parallel ghc

2001-02-14 Thread Albert Lai
I installed ghc 4.08.2 binaries for sparc solaris (and those for intel linux, too), then tried compiling a sample program (the fibonacci one in the user guide) with ghc -parallel. The compiler complained: Could not find interface file for `Prelude' in the directories ./*.hi