Adapt to ghc-8.4, Drop support for ghc<8
parent
c63327e25c
commit
e0dd252707
|
@ -42,12 +42,12 @@ library
|
||||||
other-modules: UI.Butcher.Monadic.Internal.Types
|
other-modules: UI.Butcher.Monadic.Internal.Types
|
||||||
UI.Butcher.Monadic.Internal.Core
|
UI.Butcher.Monadic.Internal.Core
|
||||||
build-depends:
|
build-depends:
|
||||||
{ base >=4.8 && <4.11
|
{ base >=4.9 && <4.12
|
||||||
, free
|
, free
|
||||||
, unsafe
|
, unsafe
|
||||||
, microlens <0.5
|
, microlens <0.5
|
||||||
, microlens-th <0.5
|
, microlens-th <0.5
|
||||||
, multistate
|
, multistate >=0.8 && <0.9
|
||||||
, pretty
|
, pretty
|
||||||
, containers
|
, containers
|
||||||
, transformers
|
, transformers
|
||||||
|
@ -103,7 +103,7 @@ test-suite tests
|
||||||
type: exitcode-stdio-1.0
|
type: exitcode-stdio-1.0
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
build-depends:
|
build-depends:
|
||||||
{ base >=4.8 && <4.11
|
{ base <999
|
||||||
, butcher
|
, butcher
|
||||||
, free
|
, free
|
||||||
, unsafe
|
, unsafe
|
||||||
|
|
|
@ -21,12 +21,12 @@ checks:
|
||||||
location: "ChangeLog.md"
|
location: "ChangeLog.md"
|
||||||
compiler-versions:
|
compiler-versions:
|
||||||
compilers:
|
compilers:
|
||||||
- compiler: "ghc"
|
|
||||||
version: "7.10.3"
|
|
||||||
- compiler: "ghc"
|
- compiler: "ghc"
|
||||||
version: "8.0.2"
|
version: "8.0.2"
|
||||||
- compiler: "ghc"
|
- compiler: "ghc"
|
||||||
version: "8.2.1"
|
version: "8.2.2"
|
||||||
|
- compiler: "ghc"
|
||||||
|
version: "8.4.1"
|
||||||
compilers-help: |
|
compilers-help: |
|
||||||
for this to work, cabal will need the paths to the actual
|
for this to work, cabal will need the paths to the actual
|
||||||
compilers to be configured; see the note about the user-global
|
compilers to be configured; see the note about the user-global
|
||||||
|
|
|
@ -80,14 +80,20 @@ data Flag p = Flag
|
||||||
, _flag_visibility :: Visibility
|
, _flag_visibility :: Visibility
|
||||||
}
|
}
|
||||||
|
|
||||||
|
appendFlag :: Flag p -> Flag p -> Flag p
|
||||||
|
appendFlag (Flag a1 b1 c1) (Flag a2 b2 c2) = Flag (a1 <|> a2)
|
||||||
|
(b1 <|> b2)
|
||||||
|
(appVis c1 c2)
|
||||||
|
where
|
||||||
|
appVis Visible Visible = Visible
|
||||||
|
appVis _ _ = Hidden
|
||||||
|
|
||||||
|
instance Semigroup (Flag p) where
|
||||||
|
(<>) = appendFlag
|
||||||
|
|
||||||
instance Monoid (Flag p) where
|
instance Monoid (Flag p) where
|
||||||
mempty = Flag Nothing Nothing Visible
|
mempty = Flag Nothing Nothing Visible
|
||||||
Flag a1 b1 c1 `mappend` Flag a2 b2 c2 = Flag (a1 <|> a2)
|
mappend = appendFlag
|
||||||
(b1 <|> b2)
|
|
||||||
(appVis c1 c2)
|
|
||||||
where
|
|
||||||
appVis Visible Visible = Visible
|
|
||||||
appVis _ _ = Hidden
|
|
||||||
|
|
||||||
-- | Create a 'Flag' with just a help text.
|
-- | Create a 'Flag' with just a help text.
|
||||||
flagHelp :: PP.Doc -> Flag p
|
flagHelp :: PP.Doc -> Flag p
|
||||||
|
|
|
@ -55,17 +55,20 @@ data Param p = Param
|
||||||
, _param_suggestions :: Maybe [CompletionItem]
|
, _param_suggestions :: Maybe [CompletionItem]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
appendParam :: Param p -> Param p -> Param p
|
||||||
|
appendParam (Param a1 b1 c1) (Param a2 b2 c2) = Param (a1 `f` a2)
|
||||||
|
(b1 `mappend` b2)
|
||||||
|
(c1 `mappend` c2)
|
||||||
|
where
|
||||||
|
f Nothing x = x
|
||||||
|
f x _ = x
|
||||||
|
|
||||||
|
instance Semigroup (Param p) where
|
||||||
|
(<>) = appendParam
|
||||||
|
|
||||||
instance Monoid (Param p) where
|
instance Monoid (Param p) where
|
||||||
mempty = Param Nothing Nothing Nothing
|
mempty = Param Nothing Nothing Nothing
|
||||||
mappend (Param a1 b1 c1)
|
mappend = appendParam
|
||||||
(Param a2 b2 c2)
|
|
||||||
= Param
|
|
||||||
(a1 `f` a2)
|
|
||||||
(b1 `mappend` b2)
|
|
||||||
(c1 `mappend` c2)
|
|
||||||
where
|
|
||||||
f Nothing x = x
|
|
||||||
f x _ = x
|
|
||||||
|
|
||||||
-- | Create a 'Param' with just a help text.
|
-- | Create a 'Param' with just a help text.
|
||||||
paramHelpStr :: String -> Param p
|
paramHelpStr :: String -> Param p
|
||||||
|
|
|
@ -325,7 +325,7 @@ ppPartDescUsage = \case
|
||||||
sgsDocs ->
|
sgsDocs ->
|
||||||
PP.parens $ PP.fcat $ PP.punctuate (PP.text "|") $ sgsDocs ++ [d]
|
PP.parens $ PP.fcat $ PP.punctuate (PP.text "|") $ sgsDocs ++ [d]
|
||||||
PartRedirect s _ -> Just $ PP.text s
|
PartRedirect s _ -> Just $ PP.text s
|
||||||
PartMany p -> rec p <&> (<> PP.text "+")
|
PartMany p -> rec p <&> (PP.<> PP.text "+")
|
||||||
PartWithHelp _ p -> rec p
|
PartWithHelp _ p -> rec p
|
||||||
PartReorder ps ->
|
PartReorder ps ->
|
||||||
let flags = [ d | PartMany d <- ps ]
|
let flags = [ d | PartMany d <- ps ]
|
||||||
|
|
|
@ -123,6 +123,7 @@ import Data.Void ( Void )
|
||||||
import System.IO ( IO )
|
import System.IO ( IO )
|
||||||
import Data.Proxy ( Proxy(..) )
|
import Data.Proxy ( Proxy(..) )
|
||||||
import Data.Sequence ( Seq )
|
import Data.Sequence ( Seq )
|
||||||
|
import Data.Semigroup ( Semigroup(..) )
|
||||||
|
|
||||||
import Data.Map ( Map )
|
import Data.Map ( Map )
|
||||||
import Data.Set ( Set )
|
import Data.Set ( Set )
|
||||||
|
@ -336,8 +337,7 @@ import Debug.Trace ( trace
|
||||||
import Foreign.ForeignPtr ( ForeignPtr
|
import Foreign.ForeignPtr ( ForeignPtr
|
||||||
)
|
)
|
||||||
|
|
||||||
import Data.Monoid ( (<>)
|
import Data.Monoid ( mconcat
|
||||||
, mconcat
|
|
||||||
, Monoid (..)
|
, Monoid (..)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -388,6 +388,7 @@ import Data.Tree ( Tree(..)
|
||||||
import Control.Monad.Trans.MultiRWS ( MonadMultiReader(..)
|
import Control.Monad.Trans.MultiRWS ( MonadMultiReader(..)
|
||||||
, MonadMultiWriter(..)
|
, MonadMultiWriter(..)
|
||||||
, MonadMultiState(..)
|
, MonadMultiState(..)
|
||||||
|
, MonadMultiGet(..)
|
||||||
)
|
)
|
||||||
|
|
||||||
import Control.Monad.Trans.MultiReader ( runMultiReaderTNil
|
import Control.Monad.Trans.MultiReader ( runMultiReaderTNil
|
||||||
|
|
Loading…
Reference in New Issue