X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fparser%2FParser.y.pp;h=f72c8b9d83f46b2085b40957b5662ba61a73ce8f;hb=3ded6e65b730c2b5eb9a9519448bbcd905c5d7fa;hp=009eddca6281abcd815386a4515deccc9c171b85;hpb=d386e0d20c6953b7cba4d53538a1782c4aa9980d;p=ghc-hetmet.git diff --git a/compiler/parser/Parser.y.pp b/compiler/parser/Parser.y.pp index 009eddc..f72c8b9 100644 --- a/compiler/parser/Parser.y.pp +++ b/compiler/parser/Parser.y.pp @@ -971,8 +971,13 @@ ctype :: { LHsType RdrName } -- errors in ctype. The basic problem is that -- (Eq a, Ord a) -- looks so much like a tuple type. We can't tell until we find the => +-- +-- We have the t1 ~ t2 form here and in gentype, to permit an individual +-- equational constraint without parenthesis. context :: { LHsContext RdrName } - : btype {% checkContext $1 } + : btype '~' btype {% checkContext + (LL $ HsPredTy (HsEqualP $1 $3)) } + | btype {% checkContext $1 } type :: { LHsType RdrName } : ipvar '::' gentype { LL (HsPredTy (HsIParam (unLoc $1) $3)) } @@ -983,7 +988,7 @@ gentype :: { LHsType RdrName } | btype qtyconop gentype { LL $ HsOpTy $1 $2 $3 } | btype tyvarop gentype { LL $ HsOpTy $1 $2 $3 } | btype '->' ctype { LL $ HsFunTy $1 $3 } - | btype '~' gentype { LL $ HsPredTy (HsEqualP $1 $3) } + | btype '~' btype { LL $ HsPredTy (HsEqualP $1 $3) } btype :: { LHsType RdrName } : btype atype { LL $ HsAppTy $1 $2 }