* Niklas Hambüchen <m...@nh2.me> [2013-03-16 03:49:29+0000]
> I would agree that what attoparsec does for <|> of Alternative and mplus
> for MonadPlus is correct since e.g. the mplus laws say that a failure
> must be identity and therefore the following alternatives must be
> considered. I also find it very convenient that attoparsec works this
> way, and prefer it to what parsec does by default.

empty/mzero are indeed identities in Parsec.

What doesn't hold is the law

   v >> mzero = mzero

But this one is often violated:

  > flip runState 0 $ runMaybeT mzero
  (Nothing,0)

  > flip runState 0 $ runMaybeT $ lift (modify (+1)) >> mzero
  (Nothing,1)

Roman

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to