The definition of lhsfun in the report
I'am confused about the "funlhs" production, in "Report on the programming Language Haskell 98" of the 1st February 1999. In the report one of the "funlhs"-productions is (see page 127): funlhs -> var apat {apat} That is a <var> followed by one to many <apat>. But you can have functions like this: fun :: Int fun = 17 That is without any patterns to match, so why is the rule not ? funlhs -> var {apat} That is a <var> followed by zero to many <apat>. I will be very happy for an answer to my question. _______________________________________________________ Send a cool gift with your E-Card http://www.bluemountain.com/giftcenter/
I'am confused about the "funlhs" production, in "Report on the programming Language Haskell 98" of the 1st February 1999.
In the report one of the "funlhs"-productions is (see page 127):
funlhs -> var apat {apat}
That is a <var> followed by one to many <apat>. But you can have functions like this:
fun :: Int fun = 17
This does not declare a function. If you look at the decl production, you will see that there is another possibility, namely pat^0, which provides this syntax. OTOH it is possible to declare a function using pat, e.g.: fun = \x -> x+1 In other words, funlhs is redundant. --- Frank Atanassow, Information & Computing Sciences, Utrecht University Padualaan 14, PO Box 80.089, 3508TB Utrecht, The Netherlands Tel +31 (0)30 253-3261 Fax +31 (0)30 251-3791
participants (2)
-
Frank Atanassow -
Mads Lindstrøm