~ patterns

John Hughes rjmh at cs.chalmers.se
Fri Jan 27 06:14:57 EST 2006

Simon Peyton-Jones wrote:

>| Actually, I think it's a much bigger wart that pattern matching in let
>| and where is lazy, and everywhere else is strict, than that we have an
>| operator ~ on patterns with a clean compositional semantics. Way back
>But ! patterns would restore what you want
>	let !(x,y) = e in ...
>Arguably, it's non-uniform, but at least the strict version would be
>much more convenient than switching to case.
Of course, it's nice to be able to get strict matching in a let if you 
want it. But what I think is
a wart is that //patterns mean different things// in a let or where, and 
in a case or lambda. That's
something you have to learn at some point, and I'd rather it was just a 
question of learning what
~ means. (You have to learn what lazy pattern matching means anyway, so 
you have to learn
the //semantics// of ~ -- learning the syntax too isn't hard).

BTW if let and where were strict-by-default, just as lambda and case 
are, then there would be
no need for ! patterns, would there?


More information about the Haskell-prime mailing list