summaryrefslogtreecommitdiff
path: root/compiler/parser
diff options
context:
space:
mode:
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)