[Haskell-cafe] [Alternative] change some/many semantics

Gregory Crosswhite gcrosswhite at gmail.com
Thu Dec 15 09:19:48 CET 2011


On Dec 15, 2011, at 5:40 PM, Antoine Latter wrote:

> I said 'combinators', not 'instances'.

Oh!  Okay, that was my bad then.

> A lot of popular parsers
> combinators can be written exclusively from (<|>) and empty, but make
> little sense for List and Maybe, and may not even function properly.
> The 'trifecta' package includes a nice reference:
> 
> http://hackage.haskell.org/packages/archive/trifecta/0.49.1/doc/html/Text-Trifecta-Parser-Combinators.html
> 
> See 'skipSome' through 'chainr1' - I wouldn't be surprised if most of
> these lead to the same infinite loop behavior for Maybe as the stock
> 'many' and 'some' in base.
> 
> These sorts of functions are what Alternative is for.

Okay, I see better now what you mean.  Thank you.

But then, if so much code based on Alternative makes little sense for List and Maybe, then maybe this should be a signal they we should remove their instance from Alternative?  After all, we already have the Monad typeclass which gives them essentially the same functionality.

Cheers,
Greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111215/5ac34e87/attachment.htm>


More information about the Haskell-Cafe mailing list