On Thu, Jun 9, 2011 at 11:31 AM, Max Bolingbroke <batterseapower@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'?