diff options
author | Max Bolingbroke <batterseapower@hotmail.com> | 2011-09-04 19:09:01 +0100 |
---|---|---|
committer | Max Bolingbroke <batterseapower@hotmail.com> | 2011-09-09 08:21:46 +0100 |
commit | 967633d4175a1d5ce525fa3194f53c219b5e2f91 (patch) | |
tree | f90e9fc633cb7d21dec9abf70f6598ca5b368ece /compiler | |
parent | 6ff6895e910b7e048c44dcfdb8f9e8c98da72f4f (diff) | |
download | haskell-967633d4175a1d5ce525fa3194f53c219b5e2f91.tar.gz |
Revert "Get rid of associated-type default declarations"
This reverts commit 5e102e64d6e581e3ea1f290547fc4be6fce20a00.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/parser/Parser.y.pp | 6 | ||||
-rw-r--r-- | compiler/parser/RdrHsSyn.lhs | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/compiler/parser/Parser.y.pp b/compiler/parser/Parser.y.pp index 1bf3810cfe..c1e1d8810a 100644 --- a/compiler/parser/Parser.y.pp +++ b/compiler/parser/Parser.y.pp @@ -670,6 +670,12 @@ at_decl_cls :: { LTyClDecl RdrName } -- infix type constructors to be declared {% mkTyFamily (comb3 $1 $2 $3) TypeFamily $2 (unLoc $3) } + -- default type instance + | 'type' type '=' ctype + -- Note the use of type for the head; this allows + -- infix type constructors and type patterns + {% mkTySynonym (comb2 $1 $4) True $2 $4 } + -- data/newtype family declaration | 'data' type opt_kind_sig {% mkTyFamily (comb3 $1 $2 $3) DataFamily $2 (unLoc $3) } diff --git a/compiler/parser/RdrHsSyn.lhs b/compiler/parser/RdrHsSyn.lhs index 6886732f7e..468c4d5898 100644 --- a/compiler/parser/RdrHsSyn.lhs +++ b/compiler/parser/RdrHsSyn.lhs @@ -565,9 +565,10 @@ checkKindSigs :: [LTyClDecl RdrName] -> P () checkKindSigs = mapM_ check where check (L l tydecl) - | isFamilyDecl tydecl = return () + | isFamilyDecl tydecl + || isSynDecl tydecl = return () | otherwise = - parseErrorSDoc l (text "Type declaration in a class must be a kind signature:" $$ ppr tydecl) + parseErrorSDoc l (text "Type declaration in a class must be a kind signature or synonym default:" $$ ppr tydecl) checkContext :: LHsType RdrName -> P (LHsContext RdrName) checkContext (L l t) |