[Haskell-cafe] [Haskell] Functor => Applicative => Monad

Tillmann Rendel rendel at informatik.uni-marburg.de
Wed Dec 15 10:16:26 CET 2010


Hi John,

John Smith wrote:
> Perhaps pattern match failures in a MonadPlus should bind to mzero - I
> believe that this is what your example and similar wish to achieve.

You updated the proposal to say:
> a failed pattern match should error in the same way as is does for pure code, while in
> MonadPlus, the current behaviour could be maintained with mzero

Can you be more specific as to how that would interact with polymorphism 
and type inference? What does it mean to be "in MonadPlus"? How does the 
compiler know?

For example, what would be the static types and dynamic semantics of the 
following expressions:

  1. \a -> do {Just x <- return (Just a); return x}

  2. do {Just x <- return Nothing; return x}

  3. \a -> do {Just x <- a; return x}

  4. \a b -> do {(x, _) <- return (a, b); return x}

  5. \a -> do {(x, _) <- return a; return x}

     Tillmann



More information about the Haskell-Cafe mailing list