[Haskell-cafe] Splitting off many/some from Alternative
Ross Paterson
ross at soi.city.ac.uk
Thu Dec 15 03:03:37 CET 2011
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)
More information about the Haskell-Cafe
mailing list