{-# LANGUAGE CPP #-}
module Ide.Plugin.Fourmolu.Shim (
cfgFilePrinterOpts,
cfgFileFixities,
emptyConfig,
addFixityOverrides,
showParseError,
) where
import Ormolu.Config
#if MIN_VERSION_fourmolu(0,7,0)
import Ormolu.Fixity
#endif
#if !MIN_VERSION_fourmolu(0,7,0)
type FourmoluConfig = PrinterOptsPartial
cfgFilePrinterOpts :: FourmoluConfig -> PrinterOptsPartial
cfgFilePrinterOpts = id
cfgFileFixities :: FourmoluConfig -> FixityMap
cfgFileFixities _ = mempty
#endif
#if MIN_VERSION_fourmolu(0,8,1)
#elif MIN_VERSION_fourmolu(0,7,0)
emptyConfig :: FourmoluConfig
emptyConfig =
FourmoluConfig
{ cfgFilePrinterOpts = mempty
, cfgFileFixities = mempty
}
#else
emptyConfig :: FourmoluConfig
emptyConfig = mempty
#endif
#if MIN_VERSION_fourmolu(0,7,0)
addFixityOverrides :: FixityMap -> Config region -> Config region
addFixityOverrides :: forall region. FixityMap -> Config region -> Config region
addFixityOverrides FixityMap
fixities Config region
cfg = Config region
cfg{cfgFixityOverrides :: FixityMap
cfgFixityOverrides = FixityMap
fixities}
#else
type FixityMap = ()
addFixityOverrides :: FixityMap -> Config region -> Config region
addFixityOverrides _ = id
#endif
#if MIN_VERSION_fourmolu(0,7,0)
showParseError :: Show parseException => parseException -> String
showParseError :: forall parseException.
Show parseException =>
parseException -> String
showParseError = forall parseException.
Show parseException =>
parseException -> String
show
#else
showParseError :: (pos, String) -> String
showParseError = snd
#endif