diff options
author | Roland Senn <rsx@bluewin.ch> | 2018-12-24 14:14:25 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2019-01-16 14:10:49 -0500 |
commit | 9fb744bdc54c75cf5b91aa783b18233ba8da04a6 (patch) | |
tree | 935207b4a3b146bdb6817c34c666936dff86b512 /compiler/main | |
parent | ce2f77d5656e847e8411805906f736a4a0a1242e (diff) | |
download | haskell-9fb744bdc54c75cf5b91aa783b18233ba8da04a6.tar.gz |
GHCi ignores cmd line flags XMonomorphismRestr.. XNoExtendedDef..#10857
Diffstat (limited to 'compiler/main')
-rw-r--r-- | compiler/main/DynFlags.hs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 7296809155..ccc2a05e50 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -34,6 +34,7 @@ module DynFlags ( wopt, wopt_set, wopt_unset, wopt_fatal, wopt_set_fatal, wopt_unset_fatal, xopt, xopt_set, xopt_unset, + xopt_set_unlessExplSpec, lang_set, useUnicodeSyntax, useStarIsType, @@ -1077,6 +1078,9 @@ data DynFlags = DynFlags { warnUnsafeOnLoc :: SrcSpan, trustworthyOnLoc :: SrcSpan, -- Don't change this without updating extensionFlags: + -- Here we collect the settings of the language extensions + -- from the command line, the ghci config file and + -- from interactive :set / :seti commands. extensions :: [OnOff LangExt.Extension], -- extensionFlags should always be equal to -- flattenExtensionFlags language extensions @@ -2378,6 +2382,19 @@ xopt_unset dfs f in dfs { extensions = onoffs, extensionFlags = flattenExtensionFlags (language dfs) onoffs } +-- | Set or unset a 'LangExt.Extension', unless it has been explicitely +-- set or unset before. +xopt_set_unlessExplSpec + :: LangExt.Extension + -> (DynFlags -> LangExt.Extension -> DynFlags) + -> DynFlags -> DynFlags +xopt_set_unlessExplSpec ext setUnset dflags = + let referedExts = stripOnOff <$> extensions dflags + stripOnOff (On x) = x + stripOnOff (Off x) = x + in + if ext `elem` referedExts then dflags else setUnset dflags ext + lang_set :: DynFlags -> Maybe Language -> DynFlags lang_set dflags lang = dflags { |