[Haskell-cafe] Data.List / Map: simple serialization?

Dmitri O.Kondratiev dokondr at gmail.com
Thu Jun 9 10:13:35 CEST 2011

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

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

This is really a simple way that I like, thanks. Do I understand this right,
that in this case Haskell run-time will  do all the necessary data buffering
as needed?
I am trying to solve the following task:

1) Parse a log of 30 000 lines where each line is about 200 chars. Parsing
includes splitting out of every line two text fields and converting them to
GUID. Then build from this log a list of GUIDs and save it for future use in
text file. As a result list will have 30 000 integer elements.

2) Read GUID list and traverse it several times from E(s) to E(N), where
E(s) - start and  E(N) - end elements of traverse, and  's' = [1.. N-1], so
I have the following traversals:
1 ...N
2 .. N
3 .. N
N-1 .. N

3) As a result of this traversal I build a Data.Map holding various pairs of
list elements (key) and number of times
pair occurs in the list (value). I need to save this map in text file for
future use.

4) Read from a text file this map back into Data.Map and build from it
another list, save it to text file, etc.

I wonder how Haskell will distribute memory between the buffer for
sequential element access (list elements, map tree nodes) and memory for
computation while reading in list, Data.Map from file?

> On 9 June 2011 08:23, Dmitri O.Kondratiev <dokondr at gmail.com> wrote:
> > Hello,
> > Please advise on existing serialization libraries.
> > I need a simple way to serialize Data.List and Data.Map  to plain text
> > files.
> >
> > Thanks,
> > Dmitri
> >
> >
> > _______________________________________________
> > Haskell-Cafe mailing list
> > Haskell-Cafe at haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
> >
> >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110609/fe0f00c6/attachment.htm>

More information about the Haskell-Cafe mailing list