[Haskell-beginners] parsec question

Michael Mossey mpm at alumni.caltech.edu
Mon Jul 19 03:32:41 EDT 2010



Magnus Therning wrote:
> 
> This isn't really an answer, but more of a suggestion on how to approach
> parsing problems.
> 
> I tend to split things until I get down to easily handled stuff.  In
> this case
> I'd probably write the following functions:
> 
>  1. Parser for strings like "v55" and "v13": result type Parser Int
>  2. Parser for strings like "c123" and "c12": result type Parser [Int]
>  3. Parser combining 1 and 2: result type Parser (Int, [Int])
>  4. Parser requiring a string starting with 'p ', combined with 3:
> result type
>     Parser Command

That makes sense.

Mike


More information about the Beginners mailing list