Add flags for Rank2Types and RankNTypes
authorIan Lynagh <igloo@earth.li>
Sun, 8 Jul 2007 17:31:50 +0000 (17:31 +0000)
committerIan Lynagh <igloo@earth.li>
Sun, 8 Jul 2007 17:31:50 +0000 (17:31 +0000)
compiler/main/DynFlags.hs
compiler/typecheck/TcMType.lhs

index c61a5da..72dbf2f 100644 (file)
@@ -194,6 +194,8 @@ data DynFlag
    | Opt_GeneralizedNewtypeDeriving
    | Opt_RecursiveDo
    | Opt_PatternGuards
+   | Opt_Rank2Types
+   | Opt_RankNTypes
 
    -- optimisation opts
    | Opt_Strictness
@@ -1113,6 +1115,8 @@ xFlags = [
   ( "FFI",                             Opt_FFI ),  -- ...and also `-fffi'
   ( "ForeignFunctionInterface",                Opt_FFI ),
 
+  ( "Rank2Types",                       Opt_Rank2Types ),
+  ( "RankNTypes",                       Opt_RankNTypes ),
   ( "RecursiveDo",                      Opt_RecursiveDo ),
   ( "Arrows",                          Opt_Arrows ), -- arrow syntax
   ( "Parr",                            Opt_PArr ),
@@ -1164,6 +1168,7 @@ glasgowExtsFlags = [ Opt_GlasgowExts
            , Opt_FunctionalDependencies
                   , Opt_MagicHash
            , Opt_PatternGuards
+           , Opt_RankNTypes
            , Opt_RecursiveDo
            , Opt_ParallelListComp
            , Opt_EmptyDataDecls
index 2a54cd3..18e58fc 100644 (file)
@@ -695,8 +695,11 @@ checkValidType :: UserTypeCtxt -> Type -> TcM ()
 checkValidType ctxt ty
   = traceTc (text "checkValidType" <+> ppr ty) `thenM_`
     doptM Opt_GlasgowExts      `thenM` \ gla_exts ->
+    doptM Opt_Rank2Types       `thenM` \ rank2 ->
+    doptM Opt_RankNTypes       `thenM` \ rankn ->
     let 
-       rank | gla_exts = Arbitrary
+       rank | rankn = Arbitrary
+            | rank2 = Rank 2
             | otherwise
             = case ctxt of     -- Haskell 98
                 GenPatCtxt     -> Rank 0