monoid-extras 0.5.1 → 0.6
raw patch · 6 files changed
+32/−26 lines, 6 filesdep ~basedep ~semigroupsPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, semigroups
API changes (from Hackage documentation)
- Data.Monoid.Action: instance Data.Monoid.Action.Action m s => Data.Monoid.Action.Action (Data.Semigroup.Option m) s
- Data.Monoid.MList: instance (Data.Monoid.Action.Action a a', Data.Monoid.Action.Action (Data.Monoid.MList.SM a) l) => Data.Monoid.Action.Action (Data.Monoid.MList.SM a) (Data.Semigroup.Option a', l)
+ Data.Monoid.Action: instance Data.Monoid.Action.Action m s => Data.Monoid.Action.Action (GHC.Maybe.Maybe m) s
+ Data.Monoid.MList: instance (Data.Monoid.Action.Action a a', Data.Monoid.Action.Action (Data.Monoid.MList.SM a) l) => Data.Monoid.Action.Action (Data.Monoid.MList.SM a) (GHC.Maybe.Maybe a', l)
- Data.Monoid.MList: alt :: (:>:) l a => (Option a -> Option a) -> l -> l
+ Data.Monoid.MList: alt :: (:>:) l a => (Maybe a -> Maybe a) -> l -> l
- Data.Monoid.MList: get :: (:>:) l a => l -> Option a
+ Data.Monoid.MList: get :: (:>:) l a => l -> Maybe a
- Data.Monoid.MList: type a ::: l = (Option a, l)
+ Data.Monoid.MList: type a ::: l = (Maybe a, l)
Files
- CHANGES +6/−0
- monoid-extras.cabal +9/−9
- src/Data/Monoid/Action.hs +3/−3
- src/Data/Monoid/Coproduct/Strict.hs +2/−1
- src/Data/Monoid/Inf.hs +2/−2
- src/Data/Monoid/MList.hs +10/−11
CHANGES view
@@ -1,3 +1,9 @@+* 0.6: 8 May 2021++- Updates for GHC 8.10 and 9.0.+- Drop support for GHC 8.2 or older.+- Replace deprecated `Option` type with `Maybe`.+ * 0.5.1: 19 Oct 2019 - New module Data.Monoid.Coproduct.Strict for a more efficient coproduct in
monoid-extras.cabal view
@@ -1,5 +1,5 @@ name: monoid-extras-version: 0.5.1+version: 0.6 synopsis: Various extra monoid-related definitions and utilities description: Various extra monoid-related definitions and utilities, such as monoid actions, monoid coproducts, semi-direct@@ -14,7 +14,7 @@ category: Data build-type: Simple cabal-version: >=1.10-tested-with: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.2, GHC == 8.6.1, GHC == 8.8.1+tested-with: GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.4, GHC == 8.10.4, GHC == 9.0.1 source-repository head type: git@@ -36,26 +36,26 @@ Data.Monoid.Split, Data.Monoid.WithSemigroup - build-depends: base >= 4.3 && < 4.14,- groups < 0.5,- semigroups >= 0.8 && < 0.20,+ build-depends: base >= 4.11 && < 4.16,+ groups < 0.6, semigroupoids >= 4.0 && < 5.4 hs-source-dirs: src ghc-options: -Wall - other-extensions: DeriveFunctor,- FlexibleInstances,- MultiParamTypeClasses,+ other-extensions: DeriveFunctor+ FlexibleInstances+ MultiParamTypeClasses TypeOperators+ ConstraintKinds benchmark semi-direct-product default-language: Haskell2010 hs-source-dirs: benchmarks main-is: SemiDirectProduct.hs type: exitcode-stdio-1.0- build-depends: base >= 4.3 && < 4.14+ build-depends: base >= 4.3 && < 4.16 , semigroups , criterion , monoid-extras
src/Data/Monoid/Action.hs view
@@ -64,9 +64,9 @@ act () = id -- | @Nothing@ acts as the identity; @Just m@ acts as @m@.-instance Action m s => Action (Option m) s where- act (Option Nothing) s = s- act (Option (Just m)) s = act m s+instance Action m s => Action (Maybe m) s where+ act Nothing s = s+ act (Just m) s = act m s -- | @Endo@ acts by application. --
src/Data/Monoid/Coproduct/Strict.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE BangPatterns #-}+{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MonoLocalBinds #-} {-# LANGUAGE MultiParamTypeClasses #-}@@ -37,7 +38,7 @@ import Data.Semigroup import Prelude --- Internal strict version of 'Data.Semigroup.Option'+-- Internal strict version of Maybe data Possible a = Only !a | Nought instance Semigroup a => Semigroup (Possible a) where
src/Data/Monoid/Inf.hs view
@@ -16,8 +16,8 @@ -- -- Make semigroups under 'min' or 'max' into monoids by adjoining an -- element corresponding to infinity (positive or negative,--- respectively). These types are similar to @Option (Min a)@ and--- @Option (Max a)@ respectively, except that the 'Ord' instance+-- respectively). These types are similar to @Maybe (Min a)@ and+-- @Maybe (Max a)@ respectively, except that the 'Ord' instance -- matches the 'Monoid' instance. -- -----------------------------------------------------------------------------
src/Data/Monoid/MList.hs view
@@ -44,7 +44,6 @@ import Control.Arrow import Data.Monoid.Action-import Data.Semigroup -- $mlist --@@ -58,10 +57,10 @@ infixr 5 ::: infixr 5 *: -type a ::: l = (Option a, l)+type a ::: l = (Maybe a, l) (*:) :: a -> l -> a ::: l-a *: l = (Option (Just a), l)+a *: l = (Just a, l) -- MList ----------------------------------- @@ -77,7 +76,7 @@ empty = () instance MList l => MList (a ::: l) where- empty = (Option Nothing, empty)+ empty = (Nothing, empty) -- Embedding ------------------------------------------- @@ -89,22 +88,22 @@ -- | Get the value of type @a@ from a heterogeneous list, if there -- is one.- get :: l -> Option a+ get :: l -> Maybe a -- | Alter the value of type @a@ by applying the given function to it.- alt :: (Option a -> Option a) -> l -> l+ alt :: (Maybe a -> Maybe a) -> l -> l #if __GLASGOW_HASKELL__ >= 710 instance {-# OVERLAPPING #-} MList t => (:>:) (a ::: t) a where #else instance MList t => (:>:) (a ::: t) a where #endif- inj a = (Option (Just a), empty)+ inj a = (Just a, empty) get = fst alt = first instance (t :>: a) => (:>:) (b ::: t) a where- inj a = (Option Nothing, inj a)+ inj a = (Nothing, inj a) get = get . snd alt = second . alt @@ -129,6 +128,6 @@ instance Action (SM a) () where act _ _ = () -instance (Action a a', Action (SM a) l) => Action (SM a) (Option a', l) where- act (SM a) (Option Nothing, l) = (Option Nothing, act (SM a) l)- act (SM a) (Option (Just a'), l) = (Option (Just (act a a')), act (SM a) l)+instance (Action a a', Action (SM a) l) => Action (SM a) (Maybe a', l) where+ act (SM a) (Nothing, l) = (Nothing, act (SM a) l)+ act (SM a) (Just a', l) = (Just (act a a'), act (SM a) l)