Re: closing file handles

2001-09-14 Thread exa
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Tuesday 11 September 2001 04:06 am, you wrote: > > There's a layout error - the statements in the do should be left-aligned: > > It's probably caused by different systems having different tab-settings. > Hmmm. So, as suspected this layout works we

Re: closing file handles

2001-09-10 Thread Lyndon While
At 9:44 am -0700 10/9/2001, Hal Daume wrote: >Simon Marlow wrote: > > go' f > > = do h<- openFile f ReadMode > > text <- hGetContents h > > let c = head text > > c `seq` do { hClose h; return c } > >This doesn't compile for me. I

RE: closing file handles

2001-09-10 Thread Julian Seward (Intl Vendor)
| I'm sorry, I had a small error in my code. It should have been: | | >go filelist = mapM go' filelist -- no "do return" | >where go' f = do h <- openFile f ReadMode | > text <- hGetContents h | > let c = head $! text | >

Re: closing file handles

2001-09-10 Thread Hal Daume
Simon Marlow wrote: > go' f > = do h<- openFile f ReadMode > text <- hGetContents h > let c = head text > c `seq` do { hClose h; return c } This doesn't compile for me. It complains that the last statement in a 'do' construct must be