From 597cbf7059161adfd8cbc935091d76aa4515f962 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Sun, 8 Jul 2007 17:31:50 +0000 Subject: [PATCH] Add flags for Rank2Types and RankNTypes --- compiler/main/DynFlags.hs | 5 +++++ compiler/typecheck/TcMType.lhs | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index c61a5da..72dbf2f 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -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 diff --git a/compiler/typecheck/TcMType.lhs b/compiler/typecheck/TcMType.lhs index 2a54cd3..18e58fc 100644 --- a/compiler/typecheck/TcMType.lhs +++ b/compiler/typecheck/TcMType.lhs @@ -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 -- 1.7.10.4