[Haskell-cafe] Why were unfailable patterns removed and "fail" added to Monad?

Jacques Carette carette at mcmaster.ca
Fri Jan 20 15:32:09 CET 2012


On 19/01/2012 10:19 PM, Edward Z. Yang wrote:
>   In other words,
> MonadZero has no place in dealing with pattern match failure!
>
I completely agree.  See "Bimonadic semantics for basic pattern matching 
calculi" [1] for an exploration of just that.  In the language of that 
paper, the issue is that there is a monad of effects for actions, and a 
monad of effects for pattern matching, and while these are very lightly 
related, they really are quite different.  By varying both monads, one 
can easily vary through a lot of different behaviour for 
pattern-matching as found in the literature.

I should add that if we had known about some of the deeper structures of 
pattern matching (as in Krishnaswami's Focusing on Pattern Matching [2], 
published 3 years *later*), we could have simplified our work.

Jacques

[1] 
http://www.cas.mcmaster.ca/~kahl/Publications/Conf/Kahl-Carette-Ji-2006a.html
[2] http://www.cs.cmu.edu/~neelk/pattern-popl09.pdf



More information about the Haskell-Cafe mailing list