Skip to content

Commit abd7a19

Browse files
Make even more forwards-compatible
1 parent 59415bb commit abd7a19

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

plugins/hls-fourmolu-plugin/src/Ide/Plugin/Fourmolu.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ provider recorder plId ideState typ contents fp fo = withIndefiniteProgress titl
117117
in liftIO (loadConfigFile fp') >>= \case
118118
ConfigLoaded file opts -> liftIO $ do
119119
logWith recorder Info $ ConfigPath file
120-
format (toConfig opts)
120+
format opts
121121
ConfigNotFound searchDirs -> liftIO $ do
122122
logWith recorder Info $ NoConfigPath searchDirs
123123
format emptyConfig

plugins/hls-fourmolu-plugin/src/Ide/Plugin/Fourmolu/Shim.hs

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
module Ide.Plugin.Fourmolu.Shim (
44
-- * FourmoluConfig
5-
FourmoluConfig (..),
6-
toConfig,
5+
cfgFilePrinterOpts,
6+
cfgFileFixities,
77
emptyConfig,
88

99
-- * FixityMap
@@ -21,29 +21,27 @@ import Ormolu.Fixity
2121

2222
{-- Backport FourmoluConfig --}
2323

24-
#if MIN_VERSION_fourmolu(0,7,0)
25-
toConfig :: FourmoluConfig -> FourmoluConfig
26-
toConfig = id
27-
#else
28-
data FourmoluConfig = FourmoluConfig
29-
{ cfgFilePrinterOpts :: PrinterOptsPartial
30-
, cfgFileFixities :: FixityMap
31-
}
24+
#if !MIN_VERSION_fourmolu(0,7,0)
25+
type FourmoluConfig = PrinterOptsPartial
3226

33-
toConfig :: PrinterOptsPartial -> FourmoluConfig
34-
toConfig opts =
35-
FourmoluConfig
36-
{ cfgFilePrinterOpts = opts
37-
, cfgFileFixities = mempty
38-
}
27+
cfgFilePrinterOpts :: FourmoluConfig -> PrinterOptsPartial
28+
cfgFilePrinterOpts = id
29+
30+
cfgFileFixities :: FourmoluConfig -> FixityMap
31+
cfgFileFixities _ = mempty
3932
#endif
4033

34+
#if MIN_VERSION_fourmolu(0,7,0)
4135
emptyConfig :: FourmoluConfig
4236
emptyConfig =
4337
FourmoluConfig
4438
{ cfgFilePrinterOpts = mempty
4539
, cfgFileFixities = mempty
4640
}
41+
#else
42+
emptyConfig :: FourmoluConfig
43+
emptyConfig = mempty
44+
#endif
4745

4846
{-- Backport FixityMap --}
4947

0 commit comments

Comments
 (0)