On Thu, Jun 9, 2011 at 11:31 AM, Max Bolingbroke <batterseapo...@hotmail.com
> wrote:

> If you want plain text serialization, "writeFile "output.txt" . show"
> and "fmap read (readFile "output.txt")" should suffice...
>
> Max
>
>
This code works:

main = do
     let xss = [[1,2,3],[4,5,6],[7,8],[9]]
     writeFile "output.txt" (show xss)
     line <- readFile "output.txt"
     let xss2 = read line :: [[Int]]
     print xss2

As soon as complete file is returned as a single line, using 'fmap'  does
not make sense here:
     line <- readFile "output.txt"
     let xss2 = fmap read line

 When to use 'fmap'?
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to