[Haskell-cafe] Splitting off many/some from Alternative

Gregory Crosswhite gcrosswhite at gmail.com
Thu Dec 15 03:19:34 CET 2011

On Dec 15, 2011, at 12:03 PM, Ross Paterson wrote:

> The current definition says that some and many should be the least
> solutions of the equations
>    some v = (:) <$> v <*> many v
>    many v = some v <|> pure []
> We could relax that to just requiring that they satisfy these equations
> (which I think is what John wants).  In that case there would be another
> possible definition for Maybe:
>    some Nothing = Nothing
>    some (Just x) = Just (repeat x)
>    many Nothing = Just []
>    many (Just x) = Just (repeat x)

That is a really good idea!  In fact, this behavior was exactly what my intuition had at first suggested to me that these methods should do.

But the part that still confuses me is:  why are these not considered the "least" solutions of the equations?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111215/918c0a51/attachment.htm>

More information about the Haskell-Cafe mailing list