Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/967633d4175a1d5ce525fa3194f53c219b5e2f91

>---------------------------------------------------------------

commit 967633d4175a1d5ce525fa3194f53c219b5e2f91
Author: Max Bolingbroke <[email protected]>
Date:   Sun Sep 4 19:09:01 2011 +0100

    Revert "Get rid of associated-type default declarations"
    
    This reverts commit 5e102e64d6e581e3ea1f290547fc4be6fce20a00.

>---------------------------------------------------------------

 compiler/parser/Parser.y.pp  |    6 ++++++
 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 1bf3810..c1e1d88 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 6886732..468c4d5 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)



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to