
On Wed, Jun 29, 2005 at 12:11:22PM +0100, Thomas Davie wrote:
On 28 Jun 2005, at 21:03, Ken T Takusagawa wrote:
The following short program:
module Main where Just foo = undefined
Causes an error message: hmake -hat hatd.hs hat-trans hatd.hs Wrote Hat/hatd.hs /usr/bin/haskell-compiler -c -package hat -o Hat/hatd.o Hat/hatd.hs
Hat/hatd.hs:10:10: Qualified variable in pattern: T.mkRoot
with hat 2.0.4 and ghc 6.4-2 (debian)
My last reply I realise was somewhat useless - in that the addition of a main function still gives the error. However, I think that this is actually hat catching a syntactic error that the normal compilers don't catch... The haskell syntax states:
decl -> gendecl | (funlhs | pat0) rhs
where, gendecl covers type definitions, funlhs covers functions (and must start with a lower case character), and pat0 covers 0 arity paterns.
The 0 is the tightness of binding, not the arity. pat^0 -> pat^1 -> ... -> pat^10 -> gcon apat_1 Such contructs look a bit odd at the top level, but I think foo x = f y where Just y = x is more common. Even more so is [ x | Just x <- xs] Thanks Ian