On Mon, Oct 02, 2006 at 11:58:44PM +0200, Yitzchak Gale wrote: > Ross Paterson wrote: > >...if we define > > exitMaybe :: Exit e () -> Maybe e > > exitMaybe (Continue _) = Nothing > > exitMaybe (Exit e) = Just e > > Maybe monads quit on failure and > continue on success. We want the opposite > semantics for guards, pattern matching, and > the like.
And that's what mplus does. > In particular, your identity > > >exitMaybe (x >> y) = exitMaybe x `mplus` exitMaybe y > > is not true. If we let x = Continue () and y = Exit z, then > > exitMaybe (x >> y) = Just z > > but > > exitMaybe x `mplus` exitMaybe y = Nothing exitMaybe (Continue ()) `mplus` exitMaybe (Exit z) = Nothing `mplus` Just z = Just z _______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://www.haskell.org/mailman/listinfo/haskell-prime