+-- These -X<blah> flags can all be reversed with -Xno-<blah>
+xFlags :: [(String, DynFlag)]
+xFlags = [
+ ( "FI", Opt_FFI ), -- support `-ffi'...
+ ( "FFI", Opt_FFI ), -- ...and also `-fffi'
+ ( "ForeignFunctionInterface", Opt_FFI ), -- ...and also `-fffi'
+
+ ( "Arrows", Opt_Arrows ), -- arrow syntax
+ ( "Parr", Opt_PArr ),
+
+ ( "TH", Opt_TH ),
+ ( "TemplateHaskelll", Opt_TH ),
+
+ ( "Generics", Opt_Generics ),
+
+ ( "ImplicitPrelude", Opt_ImplicitPrelude ), -- On by default
+
+ ( "RecordWildCards", Opt_RecordWildCards ),
+ ( "RecordPuns", Opt_RecordPuns ),
+ ( "DisambiguateRecordFields", Opt_DisambiguateRecordFields ),
+
+ ( "OverloadedStrings", Opt_OverloadedStrings ),
+ ( "GADTs", Opt_GADTs ),
+ ( "TypeFamilies", Opt_TypeFamilies ),
+ ( "BangPatterns", Opt_BangPatterns ),
+ ( "MonomorphismRestriction", Opt_MonomorphismRestriction ), -- On by default
+ ( "MonoPatBinds", Opt_MonoPatBinds ), -- On by default (which is not strictly H98)
+ ( "RelaxedPolyRec", Opt_RelaxedPolyRec),
+ ( "ExtendedDefaultRules", Opt_ExtendedDefaultRules ),
+ ( "ImplicitParams", Opt_ImplicitParams ),
+ ( "ScopedTypeVariables", Opt_ScopedTypeVariables ),
+ ( "AllowOverlappingInstances", Opt_AllowOverlappingInstances ),
+ ( "AllowUndecidableInstances", Opt_AllowUndecidableInstances ),
+ ( "AllowIncoherentInstances", Opt_AllowIncoherentInstances )
+ ]
+
+impliedFlags :: [(DynFlag, [DynFlag])]
+impliedFlags = [
+ ( Opt_GADTs, [Opt_RelaxedPolyRec] ) -- We want type-sig variables to be completely rigid for GADTs
+ ]
+
+glasgowExtsFlags = [ Opt_GlasgowExts
+ , Opt_FFI
+ , Opt_GADTs
+ , Opt_ImplicitParams
+ , Opt_ScopedTypeVariables
+ , Opt_TypeFamilies ]
+
+------------------
+isNoFlag, isFlag :: [(String,a)] -> String -> Bool
+
+isFlag flags f = is_flag flags (normaliseFlag f)
+
+isNoFlag flags no_f
+ | Just f <- noFlag_maybe (normaliseFlag no_f) = is_flag flags f
+ | otherwise = False
+
+is_flag flags nf = any (\(ff,_) -> normaliseFlag ff == nf) flags
+ -- nf is normalised alreadly