Re[Haskell-cafe] ad large file and match lines to a pattern

Ivan Miljenovic ivan.miljenovic at
Sun Jul 25 22:00:33 EDT 2010

On 26 July 2010 00:48, grzyb <zbigniew.grzybek at> wrote:
> Hi,
> I'm a beginner in haskell, I was trying to write the following code, but I
> still encourage some problems, can you help me with that?
> I need to read a large file and try to match each line to a pattern which is
> int,int value="string"
> for example:
> 0,1 value="string1"
> 1,5 value="string2"
> when the line matches the pattern then I need to get those 3 values (int,
> int, string) and pass them to my function.

Whilst you can probably use the ReadS (or ReadP if you don't care
about backwards compatability) parsers for the Read class to do this,
I highly recommend you instead learn and use a proper parsing library
such as parsec, polyparse or uuparsing-lib for this (as you'll
undoubtedly be wanting to do more extensive parsing at a later date).

Ivan Lazar Miljenovic
Ivan.Miljenovic at

More information about the Haskell-Cafe mailing list