Hello!
Can anybody help me with writing function that does
following:
I have the list ["file1","file2","file3"] and I need the
function to return me the list of contents of these files.
contents :: [String] -> [String]
contents (file:files) = do c <- readFile file
Thanks in advance
Unsafely you can write:
import IOExts
> contents :: [String] -> [String]
content = unsafePerformIO . sequence . (map readFile)
Saswat
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
At 2001-10-04 02:02, Dmitry Olyenyov wrote:
>I have the list ["file1","file2","file3"] and I need the
>function to return me the list of contents of these files.
>
>contents :: [String] -> [String]
That cannot be safely done with that type. A "pure" function like that is
not allowed to do "impe