From: Ian Lynagh Date: Mon, 9 Jul 2007 18:14:55 +0000 (+0000) Subject: Define -XPartiallyAppliedClosedTypeSynonyms flag X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=9eb79d53316804b4c384b5084825112c48f1bbc4 Define -XPartiallyAppliedClosedTypeSynonyms flag --- diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 3fdfb0b..85a7012 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -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 diff --git a/compiler/typecheck/TcMType.lhs b/compiler/typecheck/TcMType.lhs index 3ae9cef..e5ccbd0 100644 --- a/compiler/typecheck/TcMType.lhs +++ b/compiler/typecheck/TcMType.lhs @@ -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