[Haskell-cafe] Monadic parser vs. combinator parser

Ertugrul Söylemez es at ertes.de
Thu Jan 31 11:07:32 CET 2013

Jan Stolarek <jan.stolarek at p.lodz.pl> wrote:

> Thanks for replies guys. I indeed didn't notice that there are monads
> and applicatives used in this parser. My thought that monadic parsers
> are more verbose came from Hutton's paper where the code is definitely
> less readable than in example I provided.
> There is one more thing that bothers me. It is easy to write a parser
> that returns Nothing when parsing fails. But I can't figure out a way
> to add meaningful error messages so that the user knows where did the
> parsing fail. I experimented with using Either so that I can use Left
> to pass error messages but this turned out to be inflexible and
> clutered the code. I will be greatful for any ideas.

Remember that 'Either e' is also a monad. =)


Key-ID: E5DD8D11 "Ertugrul Soeylemez <es at ertes.de>"
FPrint: BD28 3E3F BE63 BADD 4157  9134 D56A 37FA E5DD 8D11
Keysrv: hkp://subkeys.pgp.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130131/17a38660/attachment.pgp>

More information about the Haskell-Cafe mailing list