diff --git a/butcher.cabal b/butcher.cabal index bed47f4..b56cbfc 100644 --- a/butcher.cabal +++ b/butcher.cabal @@ -42,12 +42,12 @@ library other-modules: UI.Butcher.Monadic.Internal.Types UI.Butcher.Monadic.Internal.Core build-depends: - { base >=4.8 && <4.11 + { base >=4.9 && <4.12 , free , unsafe , microlens <0.5 , microlens-th <0.5 - , multistate + , multistate >=0.8 && <0.9 , pretty , containers , transformers @@ -103,7 +103,7 @@ test-suite tests type: exitcode-stdio-1.0 default-language: Haskell2010 build-depends: - { base >=4.8 && <4.11 + { base <999 , butcher , free , unsafe diff --git a/iridium.yaml b/iridium.yaml index 682b300..7636457 100644 --- a/iridium.yaml +++ b/iridium.yaml @@ -21,12 +21,12 @@ checks: location: "ChangeLog.md" compiler-versions: compilers: - - compiler: "ghc" - version: "7.10.3" - compiler: "ghc" version: "8.0.2" - compiler: "ghc" - version: "8.2.1" + version: "8.2.2" + - compiler: "ghc" + version: "8.4.1" compilers-help: | for this to work, cabal will need the paths to the actual compilers to be configured; see the note about the user-global diff --git a/src/UI/Butcher/Monadic/Flag.hs b/src/UI/Butcher/Monadic/Flag.hs index 0fd8119..25fa69d 100644 --- a/src/UI/Butcher/Monadic/Flag.hs +++ b/src/UI/Butcher/Monadic/Flag.hs @@ -80,14 +80,20 @@ data Flag p = Flag , _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 mempty = Flag Nothing Nothing Visible - Flag a1 b1 c1 `mappend` Flag a2 b2 c2 = Flag (a1 <|> a2) - (b1 <|> b2) - (appVis c1 c2) - where - appVis Visible Visible = Visible - appVis _ _ = Hidden + mappend = appendFlag -- | Create a 'Flag' with just a help text. flagHelp :: PP.Doc -> Flag p diff --git a/src/UI/Butcher/Monadic/Param.hs b/src/UI/Butcher/Monadic/Param.hs index cb1b8a5..747224c 100644 --- a/src/UI/Butcher/Monadic/Param.hs +++ b/src/UI/Butcher/Monadic/Param.hs @@ -55,17 +55,20 @@ data Param p = Param , _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 mempty = Param Nothing Nothing Nothing - mappend (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 + mappend = appendParam -- | Create a 'Param' with just a help text. paramHelpStr :: String -> Param p diff --git a/src/UI/Butcher/Monadic/Pretty.hs b/src/UI/Butcher/Monadic/Pretty.hs index adad104..8cf57b8 100644 --- a/src/UI/Butcher/Monadic/Pretty.hs +++ b/src/UI/Butcher/Monadic/Pretty.hs @@ -325,7 +325,7 @@ ppPartDescUsage = \case sgsDocs -> PP.parens $ PP.fcat $ PP.punctuate (PP.text "|") $ sgsDocs ++ [d] PartRedirect s _ -> Just $ PP.text s - PartMany p -> rec p <&> (<> PP.text "+") + PartMany p -> rec p <&> (PP.<> PP.text "+") PartWithHelp _ p -> rec p PartReorder ps -> let flags = [ d | PartMany d <- ps ] diff --git a/srcinc/prelude.inc b/srcinc/prelude.inc index 6c36566..fb235a5 100644 --- a/srcinc/prelude.inc +++ b/srcinc/prelude.inc @@ -123,6 +123,7 @@ import Data.Void ( Void ) import System.IO ( IO ) import Data.Proxy ( Proxy(..) ) import Data.Sequence ( Seq ) +import Data.Semigroup ( Semigroup(..) ) import Data.Map ( Map ) import Data.Set ( Set ) @@ -336,8 +337,7 @@ import Debug.Trace ( trace import Foreign.ForeignPtr ( ForeignPtr ) -import Data.Monoid ( (<>) - , mconcat +import Data.Monoid ( mconcat , Monoid (..) ) @@ -388,6 +388,7 @@ import Data.Tree ( Tree(..) import Control.Monad.Trans.MultiRWS ( MonadMultiReader(..) , MonadMultiWriter(..) , MonadMultiState(..) + , MonadMultiGet(..) ) import Control.Monad.Trans.MultiReader ( runMultiReaderTNil