Published: pattern matching

mark at mark at
Wed Apr 19 14:48:36 UTC 2017

On 2017-04-19T10:34:31 -0400
Brian Goetz <brian.goetz at> wrote:
> Yes, we considered it.  But the reason for preferring var here is not 
> necessarily just compiler complexity; it's that it's weird for
>      if (x matches Foo(y))
> to be a _declaration_ for y.  Java developers are not used to that. 

Strongly agree here. I've taken a few programmers with no Haskell
experience through introductions to Haskell and one thing that reliably
trips them up is that patterns introduce bindings in a way that's not
totally explicit.

  f :: Nat -> Nat
  f Zero     = ...
  f (Succ z) = ...

"Where is this z variable declared?! Oh, right..."


More information about the amber-spec-experts mailing list