packages feed

functor-combinators 0.1.0.1 → 0.1.1.0

raw patch · 5 files changed

+63/−14 lines, 5 filesdep ~hedgehogdep ~tasty-hedgehogdep ~trivial-constraintPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: hedgehog, tasty-hedgehog, trivial-constraint

API changes (from Hackage documentation)

+ Data.HFunctor.Chain: appendChain :: forall t f. Monoidal t => t (Chain t (I t) f) (Chain t (I t) f) ~> Chain t (I t) f
+ Data.HFunctor.Chain: appendChain1 :: forall t f. (Semigroupoidal t, Functor f) => t (Chain1 t f) (Chain1 t f) ~> Chain1 t f

Files

CHANGELOG.md view
@@ -1,6 +1,24 @@ Changelog ========= +Version 0.1.1.0+---------------++*June 19, 2019*++<https://github.com/mstksg/functor-combinators/releases/tag/v0.1.1.0>++*   `appendChain` and `appendChain1`++Version 0.1.0.1+---------------++*June 19, 2019*++<https://github.com/mstksg/functor-combinators/releases/tag/v0.1.0.1>++*   Small tweaks for haddock generation and dependency bounds.+ Version 0.1.0.0 --------------- 
functor-combinators.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 33941e666f0eefbbab428913a4b981e1f1fc2f2cf74864c990b14b1952b529e9+-- hash: c6b3ac6a253af1f757fe65a13f8811131ac75e448c2cba76845cde36af47fdec  name:           functor-combinators-version:        0.1.0.1+version:        0.1.1.0 synopsis:       Tools for functor combinator-based program design description:    Tools for working with /functor combinators/: types that take functors (or                 other indexed types) and returns a new functor that "enhances" or "mixes"
src/Control/Applicative/ListF.hs view
@@ -19,8 +19,8 @@ -- Portability : non-portable -- -- This module provides functor combinators that are wrappers over lists or--- maybes of @f a@s, especially for their 'Data.Functor.HFunctor.Interpret'--- instances.+-- maybes of @f a@s, especially for their+-- 'Data.HFunctor.Interpret.Interpret' instances. -- -- Each one transforms a functor into some product of itself.  For example, -- @'NonEmptyF' f@ represents @f ':*:' f@, or @f :*: f :*: f@, or @f :*:
src/Control/Natural/IsoF.hs view
@@ -27,14 +27,14 @@ import           Control.Natural import           Data.Tagged --- | The type of an isomorphism between two functors.  @f <~> g@ means that+-- | The type of an isomorphism between two functors.  @f '<~>' g@ means that -- @f@ and @g@ are isomorphic to each other. ----- We can effectively /use/ an @f <~> g@ with:+-- We can effectively /use/ an @f \<~\> g@ with: -- -- @--- 'viewF'   :: (f <~> g) -> f a -> g a--- 'reviewF' :: (f <~> g) -> g a -> a a+-- 'viewF'   :: (f \<~\> g) -> f a -> g a+-- 'reviewF' :: (f \<~\> g) -> g a -> a a -- @ -- -- Use 'viewF' to extract the "@f@ to @g@" function, and 'reviewF' to@@ -45,13 +45,13 @@ -- "Prelude": -- -- @--- ('.') :: f <~> g---     -> g <~> h---     -> f <~> h+-- ('.') :: f \<~\> g+--     -> g \<~\> h+--     -> f \<~\> h -- @ ----- One nice thing about this representation is that we have the "identity"--- isomorphism by using 'id' from "Prelude".+-- Another nice thing about this representation is that we have the+-- "identity" isomorphism by using 'id' from "Prelude". -- -- @ -- 'id' :: f '<~>' g
src/Data/HFunctor/Chain.hs view
@@ -45,6 +45,7 @@   , unrollMF   , rerollMF   , unrollingMF+  , appendChain   -- * 'Chain1'   , Chain1(..)   , foldChain1@@ -52,6 +53,7 @@   , unrollingSF   , unrollSF   , rerollSF+  , appendChain1   , fromChain1   -- ** Matchable   -- | The following conversions between 'Chain' and 'Chain1' are only@@ -100,7 +102,9 @@ -- and functions. -- -- You can convert in between @'SF' t f@ and @'Chain1' t f@ with 'unrollSF'--- and 'rerollSF'.+-- and 'rerollSF'.  You can fully "collapse" a @'Chain1' t f@ into an @f@+-- with 'retract', if @t@ is 'Semigroupoidal'; this could be considered+-- a fundamental property of semigroupoidal-ness. -- -- See 'Chain' for a version that has an "empty" value. --@@ -227,6 +231,17 @@ rerollSF :: Semigroupoidal t => Chain1 t f ~> SF t f rerollSF = foldChain1 inject consSF +-- | 'Chain1' is a semigroup with respect to @t@: we can "combine" them in+-- an associative way.+--+-- @since 0.1.1.0+appendChain1+    :: forall t f. (Semigroupoidal t, Functor f)+    => t (Chain1 t f) (Chain1 t f) ~> Chain1 t f+appendChain1 = unrollSF+             . appendSF+             . hbimap rerollSF rerollSF+ -- | A useful construction that works like a "linked list" of @t f@ applied -- to itself multiple times.  That is, it contains @t f f@, @t f (t f f)@, -- @t f (t f (t f f))@, etc, with @f@ occuring /zero or more/ times.  It is@@ -249,6 +264,10 @@ -- 'Chain' allows us to work with all @'MF' t@s in a uniform way, with -- normal pattern matching and normal constructors. --+-- You can fully "collapse" a @'Chain' t (I t) f@ into an @f@ with+-- 'retract', if @t@ is 'Monoidal'; this could be considered a fundamental+-- property of monoidal-ness.+-- -- This construction is inspired by -- <http://oleg.fi/gists/posts/2018-02-21-single-free.html> data Chain t i f a = Done (i a)@@ -387,6 +406,18 @@ -- @ rerollMF :: forall t f. Monoidal t => Chain t (I t) f ~> MF t f rerollMF = foldChain (nilMF @t) consMF++-- | 'Chain' is a monoid with respect to @t@: we can "combine" them in+-- an associative way.  The identity here is anything made with the 'Done'+-- constructor.+--+-- @since 0.1.1.0+appendChain+    :: forall t f. Monoidal t+    => t (Chain t (I t) f) (Chain t (I t) f) ~> Chain t (I t) f+appendChain = unrollMF+            . appendMF+            . hbimap rerollMF rerollMF  -- | A @'Chain1' t f@ is like a non-empty linked list of @f@s, and -- a @'Chain' t ('I' t) f@ is a possibly-empty linked list of @f@s.  This