On Thu, Jun 9, 2011 at 11:31 AM, Max Bolingbroke <span dir="ltr"><<a href="mailto:batterseapower@hotmail.com">batterseapower@hotmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
If you want plain text serialization, "writeFile "output.txt" . show"<br>
and "fmap read (readFile "output.txt")" should suffice...<br>
<br>
Max<br>
<div><div></div><div class="h5"><br></div></div></blockquote><div><br>This code works:<br><br>main = do<br> let xss = [[1,2,3],[4,5,6],[7,8],[9]]<br> writeFile "output.txt" (show xss)<br> line <- readFile "output.txt"<br>
let xss2 = read line :: [[Int]] <br> print xss2<br> <br></div>As soon as complete file is returned as a single line, using 'fmap' does not make sense here: <br> line <- readFile "output.txt"<br>
let xss2 = fmap read line<br><br> When to use 'fmap'?<br>
</div>