| Opt_BangPatterns
| Opt_TypeFamilies
| Opt_OverloadedStrings
+ | Opt_DisambiguateRecordFields
+ | Opt_RecordDotDot
+ | Opt_RecordPuns
| Opt_GADTs
| Opt_RelaxedPolyRec -- -X=RelaxedPolyRec
updOptLevel :: Int -> DynFlags -> DynFlags
-- Set dynflags appropriate to the optimisation level
updOptLevel n dfs
- = dfs2{ optLevel = n }
+ = dfs2{ optLevel = final_n }
where
+ final_n = max 0 (min 2 n) -- Clamp to 0 <= n <= 2
dfs1 = foldr (flip dopt_unset) dfs remove_dopts
dfs2 = foldr (flip dopt_set) dfs1 extra_dopts
- extra_dopts = [ f | (ns,f) <- optLevelFlags, n `elem` ns ]
- remove_dopts = [ f | (ns,f) <- optLevelFlags, n `notElem` ns ]
+ extra_dopts = [ f | (ns,f) <- optLevelFlags, final_n `elem` ns ]
+ remove_dopts = [ f | (ns,f) <- optLevelFlags, final_n `notElem` ns ]
optLevelFlags :: [([Int], DynFlag)]
optLevelFlags
-- For now, allow -X flags with -f; ToDo: report this as deprecated
, ( "f", PrefixPred (isFlag xFlags) (\f -> setDynFlag (getFlag xFlags f)) )
+ , ( "f", PrefixPred (isNoFlag xFlags) (\f -> unSetDynFlag (getNoFlag xFlags f)) )
-- the rest of the -X* and -Xno-* flags
, ( "X", PrefixPred (isFlag xFlags) (\f -> setDynFlag (getFlag xFlags f)) )
glasgowExtsFlags = [ Opt_GlasgowExts
, Opt_FFI
+ , Opt_GADTs
, Opt_ImplicitParams
, Opt_ScopedTypeVariables
, Opt_TypeFamilies ]