reducers 3.0.1 → 3.0.2
raw patch · 15 files changed
+69/−16 lines, 15 filesdep ~fingertree
Dependency ranges changed: fingertree
Files
- reducers.cabal +7/−7
- src/Data/Generator.hs +3/−0
- src/Data/Generator/Combinators.hs +4/−0
- src/Data/Semigroup/Alt.hs +4/−0
- src/Data/Semigroup/Alternative.hs +4/−0
- src/Data/Semigroup/Applicative.hs +4/−0
- src/Data/Semigroup/Apply.hs +4/−0
- src/Data/Semigroup/Generator.hs +3/−0
- src/Data/Semigroup/Instances.hs +4/−0
- src/Data/Semigroup/Monad.hs +7/−3
- src/Data/Semigroup/MonadPlus.hs +8/−4
- src/Data/Semigroup/Reducer.hs +3/−0
- src/Data/Semigroup/Reducer/With.hs +4/−0
- src/Data/Semigroup/Self.hs +6/−2
- src/Data/Semigroup/Union.hs +4/−0
reducers.cabal view
@@ -1,6 +1,6 @@ name: reducers category: Data, Math, Numerical, Semigroups-version: 3.0.1+version: 3.0.2 license: BSD3 cabal-version: >= 1.6 license-file: LICENSE@@ -28,15 +28,15 @@ transformers >= 0.2 && < 0.4, bytestring >= 0.9.1 && < 0.11, containers >= 0.3 && < 0.6,- fingertree >= 0.0.1 && < 0.1,+ fingertree >= 0.0.1 && < 0.2, hashable >= 1.1.2.1 && < 1.3, text >= 0.11.1.5 && < 0.12, unordered-containers >= 0.1.4 && < 0.3,- semigroups >= 0.8.3.1,- semigroupoids >= 3.0,- comonad >= 3.0,- pointed >= 3.0,- keys >= 3.0+ semigroups >= 0.8.3.1 && < 1,+ semigroupoids >= 3 && < 4,+ comonad >= 3 && < 4,+ pointed >= 3 && < 4,+ keys >= 3 && < 4 exposed-modules: Data.Generator
src/Data/Generator.hs view
@@ -1,4 +1,7 @@ {-# LANGUAGE UndecidableInstances, FlexibleContexts, MultiParamTypeClasses, FlexibleInstances, TypeFamilies, CPP #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- |
src/Data/Generator/Combinators.hs view
@@ -1,4 +1,8 @@ {-# LANGUAGE UndecidableInstances, TypeOperators, FlexibleContexts, MultiParamTypeClasses, FlexibleInstances, TypeFamilies #-}+{-# LANGUAGE CPP #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- |
src/Data/Semigroup/Alt.hs view
@@ -1,4 +1,8 @@ {-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, GeneralizedNewtypeDeriving, FlexibleContexts #-}+{-# LANGUAGE CPP #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- |
src/Data/Semigroup/Alternative.hs view
@@ -1,4 +1,8 @@ {-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, GeneralizedNewtypeDeriving, FlexibleContexts, TypeOperators #-}+{-# LANGUAGE CPP #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- |
src/Data/Semigroup/Applicative.hs view
@@ -1,4 +1,8 @@ {-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, GeneralizedNewtypeDeriving, FlexibleContexts, TypeOperators #-}+{-# LANGUAGE CPP #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- |
src/Data/Semigroup/Apply.hs view
@@ -1,4 +1,8 @@ {-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, GeneralizedNewtypeDeriving, FlexibleContexts #-}+{-# LANGUAGE CPP #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- |
src/Data/Semigroup/Generator.hs view
@@ -1,4 +1,7 @@ {-# LANGUAGE UndecidableInstances, TypeOperators, FlexibleContexts, MultiParamTypeClasses, FlexibleInstances, TypeFamilies, CPP #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- |
src/Data/Semigroup/Instances.hs view
@@ -1,3 +1,7 @@+{-# LANGUAGE CPP #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif {-# OPTIONS_GHC -fno-warn-orphans #-} module Data.Semigroup.Instances where
src/Data/Semigroup/Monad.hs view
@@ -1,4 +1,8 @@ {-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, GeneralizedNewtypeDeriving, FlexibleContexts, TypeOperators #-}+{-# LANGUAGE CPP #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- |@@ -24,9 +28,9 @@ import Data.Semigroup.Reducer (Reducer(..)) -- | A 'Action' uses an glues together monadic actions with (>>)--- in the manner of 'mapM_' from "Data.Foldable". Any values returned by +-- in the manner of 'mapM_' from "Data.Foldable". Any values returned by -- reduced actions are discarded.-newtype Action f = Action { getAction :: f () } +newtype Action f = Action { getAction :: f () } instance Monad f => Semigroup (Action f) where Action a <> Action b = Action (a >> b)@@ -47,7 +51,7 @@ {-# RULES "unitAction" unit = Action #-} {-# RULES "snocAction" snoc = snocAction #-} -newtype Mon f m = Mon { getMon :: f m } +newtype Mon f m = Mon { getMon :: f m } deriving (Monad) instance (Monad f, Semigroup m) => Semigroup (Mon f m) where
src/Data/Semigroup/MonadPlus.hs view
@@ -1,4 +1,8 @@ {-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, GeneralizedNewtypeDeriving, FlexibleContexts, TypeOperators #-}+{-# LANGUAGE CPP #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- |@@ -24,16 +28,16 @@ -- | A 'MonadSum' turns any 'MonadPlus' instance into a 'Monoid'. -newtype MonadSum f a = MonadSum { getMonadSum :: f a } +newtype MonadSum f a = MonadSum { getMonadSum :: f a } deriving (Monad,MonadPlus) instance MonadPlus f => Semigroup (MonadSum f a) where MonadSum a <> MonadSum b = MonadSum (mplus a b)- + instance MonadPlus f => Monoid (MonadSum f a) where mempty = mzero- MonadSum a `mappend` MonadSum b = MonadSum (mplus a b) + MonadSum a `mappend` MonadSum b = MonadSum (mplus a b) instance MonadPlus f => Reducer (f a) (MonadSum f a) where- unit = MonadSum + unit = MonadSum
src/Data/Semigroup/Reducer.hs view
@@ -1,4 +1,7 @@ {-# LANGUAGE UndecidableInstances , FlexibleContexts , MultiParamTypeClasses , FlexibleInstances , GeneralizedNewtypeDeriving, TypeOperators, ScopedTypeVariables, CPP #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- |
src/Data/Semigroup/Reducer/With.hs view
@@ -1,4 +1,8 @@ {-# LANGUAGE UndecidableInstances, FlexibleContexts, MultiParamTypeClasses, FlexibleInstances #-}+{-# LANGUAGE CPP #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- |
src/Data/Semigroup/Self.hs view
@@ -1,4 +1,8 @@ {-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, GeneralizedNewtypeDeriving #-}+{-# LANGUAGE CPP #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- |@@ -10,10 +14,10 @@ -- Portability : portable -- -- A simple 'Monoid' transformer that takes a 'Monoid' m and produces a new @m@-Reducer named 'Self' @m@--- +-- -- This is useful when you have a generator that already contains monoidal values or someone supplies -- the map to the monoid in the form of a function rather than as a "Reducer" instance. You can just--- @'getSelf' . `reduce`@ or @'getSelf' . 'mapReduce' f@ in those scenarios. These behaviors are encapsulated +-- @'getSelf' . `reduce`@ or @'getSelf' . 'mapReduce' f@ in those scenarios. These behaviors are encapsulated -- into the 'fold' and 'foldMap' combinators in "Data.Monoid.Combinators" respectively. -- -----------------------------------------------------------------------------
src/Data/Semigroup/Union.hs view
@@ -1,4 +1,8 @@ {-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, GeneralizedNewtypeDeriving #-}+{-# LANGUAGE CPP #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif module Data.Semigroup.Union ( module Data.Semigroup.Reducer -- * Unions of Containers