free-algebras 0.1.0.0 → 0.1.0.1
raw patch · 6 files changed
+46/−21 lines, 6 filesdep ~data-fixdep ~dlistdep ~groupsPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: data-fix, dlist, groups
API changes (from Hackage documentation)
- Control.Algebra.Free: instance (forall (h :: * -> *). c h => Control.Monad.Zip.MonadZip h) => Control.Monad.Zip.MonadZip (Control.Algebra.Free.Free1 c f)
- Control.Algebra.Free: instance (forall (h :: * -> *). c h => GHC.Base.Alternative h) => GHC.Base.Alternative (Control.Algebra.Free.Free1 c f)
- Control.Algebra.Free: instance (forall (h :: * -> *). c h => GHC.Base.Applicative h) => GHC.Base.Applicative (Control.Algebra.Free.Free1 c f)
- Control.Algebra.Free: instance (forall (h :: * -> *). c h => GHC.Base.Monad h) => GHC.Base.Monad (Control.Algebra.Free.Free1 c f)
- Control.Algebra.Free: instance (forall (h :: * -> *). c h => GHC.Base.MonadPlus h) => GHC.Base.MonadPlus (Control.Algebra.Free.Free1 c f)
- Data.Algebra.Free: instance Data.Algebra.Free.FreeAlgebra Data.DList.DList
+ Control.Algebra.Free: instance (forall (h :: * -> *). c h => Control.Monad.Zip.MonadZip h, c (Control.Algebra.Free.Free1 c f)) => Control.Monad.Zip.MonadZip (Control.Algebra.Free.Free1 c f)
+ Control.Algebra.Free: instance (forall (h :: * -> *). c h => GHC.Base.Alternative h, c (Control.Algebra.Free.Free1 c f)) => GHC.Base.Alternative (Control.Algebra.Free.Free1 c f)
+ Control.Algebra.Free: instance (forall (h :: * -> *). c h => GHC.Base.Applicative h, c (Control.Algebra.Free.Free1 c f)) => GHC.Base.Applicative (Control.Algebra.Free.Free1 c f)
+ Control.Algebra.Free: instance (forall (h :: * -> *). c h => GHC.Base.Monad h, c (Control.Algebra.Free.Free1 c f)) => GHC.Base.Monad (Control.Algebra.Free.Free1 c f)
+ Control.Algebra.Free: instance (forall (h :: * -> *). c h => GHC.Base.MonadPlus h, c (Control.Algebra.Free.Free1 c f)) => GHC.Base.MonadPlus (Control.Algebra.Free.Free1 c f)
+ Data.Algebra.Free: instance Data.Algebra.Free.FreeAlgebra Data.DList.Internal.DList
- Control.Algebra.Free: Free1 :: (forall g. c g => (forall x. f x -> g x) -> g a) -> Free1 a
+ Control.Algebra.Free: Free1 :: (forall g. c g => (forall x. f x -> g x) -> g a) -> Free1 (c :: (Type -> Type) -> Constraint) (f :: Type -> Type) a
- Control.Algebra.Free: [runFree1] :: Free1 a -> forall g. c g => (forall x. f x -> g x) -> g a
+ Control.Algebra.Free: [runFree1] :: Free1 (c :: (Type -> Type) -> Constraint) (f :: Type -> Type) a -> forall g. c g => (forall x. f x -> g x) -> g a
- Control.Monad.Action: FreeMAction :: m (f a) -> FreeMAction a
+ Control.Monad.Action: FreeMAction :: m (f a) -> FreeMAction (m :: Type -> Type) (f :: Type -> Type) a
- Control.Monad.Action: [runFreeMAction] :: FreeMAction a -> m (f a)
+ Control.Monad.Action: [runFreeMAction] :: FreeMAction (m :: Type -> Type) (f :: Type -> Type) a -> m (f a)
- Data.Algebra.Free: Free :: (forall r. c r => (a -> r) -> r) -> Free a
+ Data.Algebra.Free: Free :: (forall r. c r => (a -> r) -> r) -> Free (c :: Type -> Constraint) a
- Data.Algebra.Free: [runFree] :: Free a -> forall r. c r => (a -> r) -> r
+ Data.Algebra.Free: [runFree] :: Free (c :: Type -> Constraint) a -> forall r. c r => (a -> r) -> r
Files
- free-algebras.cabal +19/−14
- src/Control/Algebra/Free.hs +5/−5
- src/Data/Algebra/Free.hs +8/−0
- src/Data/Group/Free.hs +8/−0
- src/Data/Semigroup/Abelian.hs +4/−0
- test/Test/Control/Algebra/Free.hs +2/−2
free-algebras.cabal view
@@ -1,6 +1,6 @@-cabal-version: 2.0+cabal-version: 2.2 name: free-algebras-version: 0.1.0.0+version: 0.1.0.1 synopsis: Free algebras description: Algebraic approach to free algebras, inspired by Univeral Algebra and@@ -10,8 +10,8 @@ homepage: https://github.com/coot/free-algebras#readme bug-reports: https://github.com/coot/free-algebras/issues author: Marcin Szamotulski-maintainer: profunctor@pm.me-copyright: (c) 2018-2020 Marcin Szamotulski+maintainer: coot@coot.me+copyright: (c) 2018-2021 Marcin Szamotulski license: MPL-2.0 license-file: LICENSE build-type: Simple@@ -19,13 +19,24 @@ ChangeLog.md README.md stability: experimental-tested-with: GHC==8.6.5, GHC==8.8.3, GHC==8.10.1+tested-with: GHC==8.6.5, GHC==8.8.4, GHC==8.10.4 source-repository head type: git location: https://github.com/coot/free-algebras ++common ghc-options+ ghc-options:+ -Wall+ -Wincomplete-record-updates+ -Wincomplete-uni-patterns+ -Wredundant-constraints+ -Wno-deprecations++ library+ import: ghc-options exposed-modules: Control.Algebra.Free Control.Algebra.Free2@@ -41,19 +52,13 @@ build-depends: base >= 4.9 && <5 , containers >= 0.4.2 && <0.7- , data-fix <0.3- , dlist >= 0.8 && <0.9+ , data-fix <0.4+ , dlist >= 0.8 && <1.1 , free >= 4.0 && <6.0- , groups >= 0.3 && <0.5+ , groups >= 0.3 && <0.6 , kan-extensions >= 4.1 && <6.0 , mtl >= 2.2 && <2.3 , transformers >= 0.5 && <0.6- ghc-options:- -Wall- -Wincomplete-record-updates- -Wincomplete-uni-patterns- -Wredundant-constraints- -Wno-deprecations default-language: Haskell2010 test-suite test-free-algebras
src/Control/Algebra/Free.hs view
@@ -627,7 +627,7 @@ -- | @'Free1'@ is an applicative functor whenever @c f@ implies @'Applicative' -- f@. ---instance (forall h. c h => Applicative h)+instance (forall h. c h => Applicative h, c (Free1 c f)) => Applicative (Free1 c f) where pure a = Free1 $ \_ -> pure a@@ -643,7 +643,7 @@ -- | @'Free1'@ is a monad whenever @c f@ implies @'Monad' f@. ---instance (forall h. c h => Monad h)+instance (forall h. c h => Monad h, c (Free1 c f)) => Monad (Free1 c f) where return = pure@@ -658,7 +658,7 @@ #endif -instance (forall h. c h => Alternative h)+instance (forall h. c h => Alternative h, c (Free1 c f)) => Alternative (Free1 c f) where empty = Free1 $ \_ -> empty @@ -669,7 +669,7 @@ many (Free1 f) = Free1 $ \h -> many (f h) -instance (forall h. c h => MonadPlus h)+instance (forall h. c h => MonadPlus h, c (Free1 c f)) => MonadPlus (Free1 c f) where mzero = Free1 $ \_ -> mzero@@ -677,7 +677,7 @@ Free1 f `mplus` Free1 g = Free1 $ \h -> f h `mplus` g h -instance (forall h. c h => MonadZip h)+instance (forall h. c h => MonadZip h, c (Free1 c f)) => MonadZip (Free1 c f) where Free1 f `mzip` Free1 g = Free1 $ \h -> f h `mzip` g h
src/Data/Algebra/Free.hs view
@@ -43,7 +43,11 @@ #endif import Data.DList as DList import Data.Functor.Identity (Identity (..))+#if MIN_VERSION_data_fix(0,3,0)+import Data.Fix (Fix, foldFix)+#else import Data.Fix (Fix, cata)+#endif import Data.Group (Group (..)) import Data.Kind (Constraint, Type) import Data.List.NonEmpty (NonEmpty (..))@@ -269,7 +273,11 @@ ) => Fix m -> a+#if MIN_VERSION_data_fix(0,3,0)+cataFree = foldFix foldFree+#else cataFree = cata foldFree+#endif -- | A version of @'Data.Foldable.foldr'@, e.g. it can specialize to --
src/Data/Group/Free.hs view
@@ -25,6 +25,9 @@ import Data.Bifunctor (bimap) import Data.DList (DList) import qualified Data.DList as DList+#if MIN_VERSION_dlist(1,0,0)+import Data.DList.Unsafe (DList (..))+#endif import Data.Group (Group (..)) import Data.List (foldl') #if __GLASGOW_HASKELL__ < 808@@ -114,7 +117,12 @@ foldMapFree _ (FreeGroup DList.Nil) = mempty foldMapFree f (FreeGroup as) = let a' = DList.head as+#if MIN_VERSION_dlist(1,0,0)+ as' = case as of+ UnsafeDList g -> UnsafeDList (drop 1 . g)+#else as' = DList.tail as+#endif in either (invert . f) f a' `mappend` foldMapFree f (FreeGroup as') -- | Free group in the class of groups which multiplication is strict on the
src/Data/Semigroup/Abelian.hs view
@@ -60,7 +60,11 @@ instance Ord a => AbelianSemigroup (Min a) +#if __GLASGOW_HASKELL__ >= 900+instance AbelianSemigroup a => AbelianSemigroup (Maybe a)+#else instance AbelianSemigroup a => AbelianSemigroup (Option a)+#endif instance Num a => AbelianSemigroup (Product a)
test/Test/Control/Algebra/Free.hs view
@@ -275,14 +275,14 @@ (genFreeIdentity (Gen.int $ Range.linear 0 1000)) show runIdentity- Free.iter+ (\f -> Free.iter f) prop_iterFree1_ap :: Property prop_iterFree1_ap = iterFree1_property (genApIdentity (Gen.int $ Range.linear 0 1000) genIntToInt) (show . Ap.retractAp) runIdentity- Ap.iterAp+ (\f -> Ap.iterAp f) foldNatFree_liftFree_property :: forall m g f a proxy n.