Re: [Haskell-beginners] if statements

Hi John,
The @ in a pattern is called an 'as-pattern'. They are explained in
this tutorial: http://www.haskell.org/tutorial/patterns.html
Very briefly they assign a name to a pattern.
I'm not sure why you get a type error. I could load the code into GHCI
without problems. When the compiler complains about missing instanced
for Num than it usually means you did something like (x + y) where x
and y are of type E without E having an instance for Num. For example
(Val 3) + (Val 4) would result in such an error.
On Sat, Jan 23, 2010 at 7:32 PM, John Moore
Hi Roel, This isn't working, what does @ stand for in evalStep (Add x@(Val _) y) = Add x (evalStep y) Maybe this is a mistype It's asking me for a instance declaration for (num expression)
John
participants (1)
-
Roel van Dijk