@@ -6,6 +6,7 @@
66
77module Ormolu.Parser
88 ( parseModule
9+ , manualExts
910 )
1011where
1112
@@ -67,6 +68,28 @@ parseModule dynOpts path input' = liftIO $ do
6768 }
6869 return (ws, r)
6970
71+-- | Extensions that are not enabled automatically and should be activated
72+-- by user.
73+
74+manualExts :: [Extension]
75+manualExts =
76+ [ Arrows -- steals proc
77+ , Cpp -- forbidden
78+ , PatternSynonyms -- steals the pattern keyword
79+ , RecursiveDo -- steals the rec keyword
80+ , StaticPointers -- steals static keyword
81+ , TransformListComp -- steals the group keyword
82+ , UnboxedTuples -- breaks (#) lens operator
83+ , MagicHash -- screws {-# these things #-}
84+ , AlternativeLayoutRule
85+ , AlternativeLayoutRuleTransitional
86+ , MonadComprehensions
87+ , UnboxedSums
88+ , TemplateHaskellQuotes -- enables TH subset of quasi-quotes, this
89+ -- apparently interferes with QuasiQuotes in
90+ -- weird ways
91+ ]
92+
7093----------------------------------------------------------------------------
7194-- Helpers (taken from ghc-exactprint)
7295
@@ -161,26 +184,9 @@ getPragma s@(x:xs)
161184-- default for ease of use.
162185
163186setDefaultExts :: DynFlags -> DynFlags
164−setDefaultExts flags = foldl' GHC.xopt_set flags whitelist
187+setDefaultExts flags = foldl' GHC.xopt_set flags autoExts
165188 where
166− whitelist = allExts \\ blacklist
189+ autoExts = allExts \\ manualExts
167190 allExts = [minBound..maxBound]
168− blacklist =
169− [ Arrows -- steals proc
170− , Cpp -- forbidden
171− , PatternSynonyms -- steals the pattern keyword
172− , RecursiveDo -- steals the rec keyword
173− , StaticPointers -- steals static keyword
174− , TransformListComp -- steals the group keyword
175− , UnboxedTuples -- breaks (#) lens operator
176− , MagicHash -- screws {-# these things #-}
177− , AlternativeLayoutRule
178− , AlternativeLayoutRuleTransitional
179− , MonadComprehensions
180− , UnboxedSums
181− , TemplateHaskellQuotes -- enables TH subset of quasi-quotes, this
182− -- apparently interferes with QuasiQuotes in
183− -- weird ways
184− ]
185191
186192deriving instance Bounded Extension