summaryrefslogtreecommitdiff
path: root/compiler/parser
diff options
context:
space:
mode:
authorMax Bolingbroke <batterseapower@hotmail.com>2011-09-04 19:09:01 +0100
committerMax Bolingbroke <batterseapower@hotmail.com>2011-09-09 08:21:46 +0100
commit967633d4175a1d5ce525fa3194f53c219b5e2f91 (patch)
treef90e9fc633cb7d21dec9abf70f6598ca5b368ece /compiler/parser
parent6ff6895e910b7e048c44dcfdb8f9e8c98da72f4f (diff)
downloadhaskell-967633d4175a1d5ce525fa3194f53c219b5e2f91.tar.gz
Revert "Get rid of associated-type default declarations"
This reverts commit 5e102e64d6e581e3ea1f290547fc4be6fce20a00.
Diffstat (limited to 'compiler/parser')
-rw-r--r--compiler/parser/Parser.y.pp6
-rw-r--r--compiler/parser/RdrHsSyn.lhs5
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)