1{-# LANGUAGE GeneralizedNewtypeDeriving #-}
2{-# LANGUAGE OverloadedStrings #-}
3{-# LANGUAGE RecordWildCards #-}
5-- | Configuration options used by the tool.
11 , dynOptionToLocatedStr
16import qualified SrcLoc as GHC
18-- | Ormolu configuration.
21 { cfgDynOptions :: ![DynOption]
22 -- ^ Dynamic options to pass to GHC parser
24 -- ^ Do formatting faster but without automatic detection of defects
26 -- ^ Output information useful for debugging
29instance Semigroup Config where
31 { cfgDynOptions = cfgDynOptions a <> cfgDynOptions b
32 , cfgUnsafe = cfgUnsafe a || cfgUnsafe b
33 , cfgDebug = cfgDebug a || cfgDebug b
36instance Monoid Config where
37 mempty = defaultConfig
40instance FromJSON Config where
41 parseJSON = withObject "config" $ \o -> do
42 cfgDynOptions <- o .: "ghc-opts"
43 cfgUnsafe <- o .: "unsafe"
44 cfgDebug <- o .: "debug"
49defaultConfig :: Config
56-- | A wrapper for dynamic options.
58newtype DynOption = DynOption
59 { unDynOption :: String
60 } deriving (Eq, Ord, Show, FromJSON)
62-- | Convert 'DynOption' to @'GHC.Located' 'String'@.
64dynOptionToLocatedStr :: DynOption -> GHC.Located String
65dynOptionToLocatedStr (DynOption o) = GHC.L GHC.noSrcSpan o
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list