Define -XPartiallyAppliedClosedTypeSynonyms flag
authorIan Lynagh <igloo@earth.li>
Mon, 9 Jul 2007 18:14:55 +0000 (18:14 +0000)
committerIan Lynagh <igloo@earth.li>
Mon, 9 Jul 2007 18:14:55 +0000 (18:14 +0000)
compiler/main/DynFlags.hs
compiler/typecheck/TcMType.lhs

index 3fdfb0b..85a7012 100644 (file)
@@ -199,6 +199,7 @@ data DynFlag
    | Opt_GeneralizedNewtypeDeriving
    | Opt_RecursiveDo
    | Opt_PatternGuards
+   | Opt_PartiallyAppliedClosedTypeSynonyms
    | Opt_Rank2Types
    | Opt_RankNTypes
    | Opt_TypeOperators
@@ -1128,6 +1129,7 @@ xFlags = [
   ( "FFI",                             Opt_FFI ),  -- ...and also `-fffi'
   ( "ForeignFunctionInterface",                Opt_FFI ),
 
+  ( "PartiallyAppliedClosedTypeSynonyms", Opt_PartiallyAppliedClosedTypeSynonyms ),
   ( "Rank2Types",                       Opt_Rank2Types ),
   ( "RankNTypes",                       Opt_RankNTypes ),
   ( "TypeOperators",                    Opt_TypeOperators ),
@@ -1188,6 +1190,7 @@ glasgowExtsFlags = [ Opt_GlasgowExts
            , Opt_ExistentialQuantification
            , Opt_UnicodeSyntax
            , Opt_PatternGuards
+           , Opt_PartiallyAppliedClosedTypeSynonyms
            , Opt_RankNTypes
            , Opt_TypeOperators
            , Opt_RecursiveDo
index 3ae9cef..e5ccbd0 100644 (file)
@@ -838,10 +838,9 @@ check_tau_type rank ubx_tup ty@(TyConApp tc tys)
                                && tyConArity tc <= length tys) $
                          failWithTc arity_msg
 
-       ; gla_exts <- doptM Opt_GlasgowExts
-       ; if gla_exts && not (isOpenTyCon tc) then
-       -- If -fglasgow-exts then don't check the type arguments of 
-       -- *closed* synonyms.
+       ; ok <- doptM Opt_PartiallyAppliedClosedTypeSynonyms
+       ; if ok && not (isOpenTyCon tc) then
+       -- Don't check the type arguments of *closed* synonyms.
        -- This allows us to instantiate a synonym defn with a 
        -- for-all type, or with a partially-applied type synonym.
        --      e.g.   type T a b = a