News for hackers. Stuff that matters.
Re:Fay -- A proper subset of Haskell that compiles to Javasc... by angeladur on Sunday July 22, 2012 @11:40PM (#4279436)
What does getSquare (Math _ square _) = square mean?
Re:Fay -- A proper subset of Haskell that compiles to Javasc... by chrisdone on Monday July 23, 2012 @05:56AM (#4280270)
That's a pattern match. Math is a data constructor, it makes a Math object. It takes three arguments. So (Math 1 2 3) is a Math object.

A pattern is a way of deconstructing an object into its constituent parts and bringing some of those into scope.So (Math x y z) is a valid pattern, which would bring these values into scope: x=1, y=2, z=3. In this case I'm bringing only the second argument into scope. In a pattern, _ means "ignore this argument".

Here is a short interactive lesson on pattern matching: http://tryhaskell.org/#19