[Haskell-beginners] Parsing

Francesco Ariis fa-ml at ariis.it
Sun Mar 6 09:30:19 UTC 2016


On Sun, Mar 06, 2016 at 09:26:17AM +0000, Mike Houghton wrote:
> Hi, I’m using Parsec to parse structured text and have some problems
> with mandatory and optional text entries and the order in which they
> occur.
> For example:
> 
> module{
> 
>     name   = some string
>     source = …
> 
>     dest              = …..
>     bundle          = …
>     bundle_dest = … 
>     zip_name     = ….
> 
> }

Hello Mike,
    I would personally keep it simple. Parse the (item, value) list
and after that check if it is well formed (i.e. contains 'name' and
'source' values). If not, call `parserFail` with an appropriate
message.


More information about the Beginners mailing list