packages feed

free-functors 0.4 → 0.4.1

raw patch · 4 files changed

+25/−10 lines, 4 filesdep ~algebraic-classesdep ~comonadPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: algebraic-classes, comonad

API changes (from Hackage documentation)

+ Data.Functor.Cofree: outL :: Product c m n -> m
+ Data.Functor.Cofree: outR :: Product c m n -> n
+ Data.Functor.Cofree: product :: c a => (a -> m) -> (a -> n) -> a -> Product c m n
+ Data.Functor.Cofree: terminal :: c a => a -> TerminalObject c
+ Data.Functor.Cofree: type Product c m n = Cofree c (m, n)
+ Data.Functor.Cofree: type TerminalObject c = Cofree c ()
- Data.Functor.Free: inL :: c m => m -> Coproduct c m n
+ Data.Functor.Free: inL :: m -> Coproduct c m n
- Data.Functor.Free: inR :: c n => n -> Coproduct c m n
+ Data.Functor.Free: inR :: n -> Coproduct c m n

Files

examples/NonEmptyList.hs view
@@ -9,11 +9,7 @@ import Data.Functor.Identity import Data.Functor.Compose -class Semigroup s where-  (<>) :: s -> s -> s--instance Semigroup [a] where-  (<>) = (++)+import Data.Semigroup    -- This declaration creates a Functor that is also Applicative. type NonEmptyList = Free Semigroup
free-functors.cabal view
@@ -1,5 +1,5 @@ name:                free-functors-version:             0.4+version:             0.4.1 synopsis:            Provides free functors that are adjoint to functors that forget class constraints.  description:         A free functor is a left adjoint to a forgetful functor. It used to be the case                      that the only category that was easy to work with in Haskell was Hask itself, so@@ -43,9 +43,9 @@     base >= 4.4 && < 5,     constraints >= 0.3.2 && < 0.4,     transformers >= 0.2.0.0 && < 0.4,-    comonad >= 3.0 && < 3.1,+    comonad >= 3.0 && < 3.2,     void >= 0.4 && < 0.7,-    algebraic-classes >= 0.1 && < 0.3+    algebraic-classes >= 0.1 && < 0.4  source-repository head   type:     git
src/Data/Functor/Cofree.hs view
@@ -79,3 +79,22 @@  convert :: (c (w a), Comonad w) => w a -> Cofree c a convert = leftAdjunct extract+++-- * Products++type Product c m n = Cofree c (m, n)++product :: c a => (a -> m) -> (a -> n) -> a -> Product c m n+product m n = leftAdjunct (\a -> (m a, n a))++outL :: Product c m n -> m+outL = fst . counit++outR :: Product c m n -> n+outR = snd . counit++type TerminalObject c = Cofree c ()++terminal :: c a => a -> TerminalObject c+terminal = leftAdjunct (const ())
src/Data/Functor/Free.hs view
@@ -120,10 +120,10 @@ coproduct :: c r => (m -> r) -> (n -> r) -> Coproduct c m n -> r coproduct m n = rightAdjunct (either m n) -inL :: c m => m -> Coproduct c m n+inL :: m -> Coproduct c m n inL = unit . Left -inR :: c n => n -> Coproduct c m n+inR :: n -> Coproduct c m n inR = unit . Right  type InitialObject c = Free c Void