X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcRnMonad.lhs;h=6d5d6d1a4cbf3f52e188e8dd612897bb4c799344;hb=1971591f865ac0806802c476f23792ae2c89411a;hp=f4b9131f4a0d566f5253a5ab0a55d523f8babe0a;hpb=46c673a70fe14fe05d7160b456925b8591b5f779;p=ghc-hetmet.git diff --git a/compiler/typecheck/TcRnMonad.lhs b/compiler/typecheck/TcRnMonad.lhs index f4b9131..6d5d6d1 100644 --- a/compiler/typecheck/TcRnMonad.lhs +++ b/compiler/typecheck/TcRnMonad.lhs @@ -35,7 +35,7 @@ import Bag import Outputable import UniqSupply import Unique -import LazyUniqFM +import UniqFM import DynFlags import StaticFlags import FastString @@ -230,19 +230,21 @@ Command-line flags getDOpts :: TcRnIf gbl lcl DynFlags getDOpts = do { env <- getTopEnv; return (hsc_dflags env) } -doptM :: DynFlag -> TcRnIf gbl lcl Bool +doptM :: DOpt d => d -> TcRnIf gbl lcl Bool doptM flag = do { dflags <- getDOpts; return (dopt flag dflags) } -setOptM :: DynFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a +-- XXX setOptM and unsetOptM operate on different types. One should be renamed. + +setOptM :: ExtensionFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a setOptM flag = updEnv (\ env@(Env { env_top = top }) -> - env { env_top = top { hsc_dflags = dopt_set (hsc_dflags top) flag}} ) + env { env_top = top { hsc_dflags = lopt_set_flattened (hsc_dflags top) flag}} ) unsetOptM :: DynFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a unsetOptM flag = updEnv (\ env@(Env { env_top = top }) -> env { env_top = top { hsc_dflags = dopt_unset (hsc_dflags top) flag}} ) -- | Do it flag is true -ifOptM :: DynFlag -> TcRnIf gbl lcl () -> TcRnIf gbl lcl () +ifOptM :: DOpt d => d -> TcRnIf gbl lcl () -> TcRnIf gbl lcl () ifOptM flag thing_inside = do { b <- doptM flag; if b then thing_inside else return () }