A problem about hGetContents -- with another question

Nick Name nick.name@inwind.it
Sun, 19 Jan 2003 18:06:16 +0100


On Sun, 19 Jan 2003 08:51:31 -0800
"Mark P Jones" <mpj@cse.ogi.edu> wrote:

> 
>    linesFromFile  = fmap lines . readFile

Nice :) BTW, is readFile implemented with some strict evaluation
construct ?

I got another trouble: I need to build a record type like

Package { name :: String, version :: Int , mantainer :: String ... other
fields ... }

from a list of string of the form

["Package: ..." , "Mantainer: ..." , "Version: ..." , ... ]

where the fields are not bound to be in a particular order, except for
Package wich is always the first of a record.

The natural solution in this case seems to be a mutable record, and an
iteration over the list. Has someone got ideas? This appear to be a
particularly difficult problem in haskell and it should not be.

V.

PS: I've just noticed that by mistake I posted on haskell and not
haskell-cafe. Sorry for the inconvenience, now I end the thread here but
I will not post other newbie questions here.

-- 
Teatri vuoti e inutili potrebbero affollarsi
se tu ti proponessi di recitare te
[CCCP]