
On Wed, Dec 14, 2011 at 8:03 PM, Ross Paterson
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)
This seems to generalize to list: some [] = [] some xs = [cycle xs] many [] = [[]] many xs = [cycle xs] Although I'm still not sure why I would be using these operations in maybe or list. Antoine
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe