packages feed

monoidal-functors 0.1.0.0 → 0.1.1.0

raw patch · 5 files changed

+74/−46 lines, 5 filesdep ~bifunctorsdep ~comonaddep ~contravariantPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: bifunctors, comonad, contravariant, profunctors, semigroupoids, tagged, these

API changes (from Hackage documentation)

- Data.Bifunctor.BiInvariant: Iso :: (a -> b) -> (b -> a) -> Iso a b
- Data.Bifunctor.BiInvariant: data Iso a b
- Data.Functor.Invariant: Iso :: (a -> b) -> (b -> a) -> Iso a b
- Data.Functor.Invariant: data Iso a b
- Data.Bifunctor.BiInvariant: biinvIso :: BiInvariant p => Iso a a' -> Iso b b' -> Iso (p a b) (p a' b')
+ Data.Bifunctor.BiInvariant: biinvIso :: BiInvariant p => Iso (->) a a' -> Iso (->) b b' -> Iso (->) (p a b) (p a' b')
- Data.Functor.Invariant: invIso :: Invariant f => Iso a a' -> Iso (f a) (f a')
+ Data.Functor.Invariant: invIso :: Invariant f => Iso (->) a a' -> Iso (->) (f a) (f a')

Files

CHANGELOG.md view
@@ -1,5 +1,10 @@ # Revision history for monoidal-functors -## 0.1.0.0 -- YYYY-mm-dd+## 0.1.1 -- 2021-12-13 -* First version. Released on an unsuspecting world.+* Removes redundant `Iso` types.+* Some intitial attempts at documentation.++## 0.1.0.0 -- 2021-04-19++* First version.
monoidal-functors.cabal view
@@ -1,30 +1,33 @@ cabal-version:       2.4 name:                monoidal-functors category:            Control, Categories-version:             0.1.0.0+version:             0.1.1.0 license:             MIT license-file:        LICENSE author:              Solomon Bothwell & Asad Saeeduddin maintainer:          ssbothwell@gmail.com stability:           experimental-homepage:            http://github.com/ssbothwell/monoidal-functors+synopsis:            Monoidal Functors Library+homepage:            http://github.com/solomon-b/monoidal-functors build-type:          Simple extra-source-files:  CHANGELOG.md description:   A typeclass hierarchy for monoidal functors. +source-repository head+  type:     git+  location: https://github.com/solomon-b/monoidal-functors+ library   build-depends:-      base           >= 4.12    && < 5-    -- , base-orphans  ^>= 0.8.4-    , bifunctors-    , comonad-    , contravariant-    , profunctors-    , semigroupoids-    , tagged-    , these-    -- , transformers  ^>= 0.5+    base           >= 4.12    && < 5,+    bifunctors           >= 5.5.11 && < 5.6,+    comonad              >= 5.0.8 && < 5.1,+    tagged               >= 0.8.6 && < 0.9,+    contravariant        >= 1.5.5 && < 1.6,+    profunctors          >= 5.6.2 && < 5.7,+    semigroupoids        >= 5.3.6 && < 5.4,+    these                >= 1.1.1 && < 1.2,    exposed-modules:     Control.Category.Tensor@@ -38,7 +41,7 @@     Data.Trifunctor.Module     Data.Trifunctor.Monoidal -  ghc-options: -Wall -O2 -Wno-trustworthy-safe -Wno-star-is-type+  ghc-options: -Wall -Wno-trustworthy-safe -Wno-star-is-type    if impl(ghc >= 9.0)     -- these flags may abort compilation with GHC-8.10@@ -49,22 +52,23 @@    default-language: Haskell2010 -  default-extensions: ConstraintKinds-                      DeriveFunctor-                      DerivingVia-                      FunctionalDependencies-                      FlexibleInstances-                      FlexibleContexts-                      GeneralizedNewtypeDeriving-                      InstanceSigs-                      KindSignatures-                      LambdaCase-                      MultiParamTypeClasses-                      NoImplicitPrelude-                      QuantifiedConstraints-                      RankNTypes-                      ScopedTypeVariables-                      StandaloneDeriving-                      TypeApplications-                      TypeOperators-                      UndecidableInstances+  default-extensions:+    ConstraintKinds+    DeriveFunctor+    DerivingVia+    FunctionalDependencies+    FlexibleInstances+    FlexibleContexts+    GeneralizedNewtypeDeriving+    InstanceSigs+    KindSignatures+    LambdaCase+    MultiParamTypeClasses+    NoImplicitPrelude+    QuantifiedConstraints+    RankNTypes+    ScopedTypeVariables+    StandaloneDeriving+    TypeApplications+    TypeOperators+    UndecidableInstances
src/Data/Bifunctor/BiInvariant.hs view
@@ -2,6 +2,7 @@  import Prelude import Control.Arrow+import Control.Category.Tensor import Control.Comonad import Data.Bifunctor import Data.Bifunctor.Biap@@ -37,8 +38,7 @@   biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> p a b -> p a' b'  -- BiInvariant witnesses an Isomorphism-data Iso a b = Iso (a -> b) (b -> a)-biinvIso :: BiInvariant p => Iso a a' -> Iso b b' -> Iso (p a b) (p a' b')+biinvIso :: BiInvariant p => Iso (->) a a' -> Iso (->) b b' -> Iso (->) (p a b) (p a' b') biinvIso (Iso f f') (Iso g g') = Iso (biinvmap f' f g' g) (biinvmap f f' g g')  newtype FromProfunctor p a b = FromProfunctor { runPro :: p a b}
src/Data/Functor/Invariant.hs view
@@ -2,6 +2,7 @@  import Prelude import Control.Applicative (ZipList)+import Control.Category.Tensor import Data.Functor.Contravariant import Data.Functor.Compose import Data.Functor.Identity@@ -12,10 +13,7 @@ class Invariant f where   invmap :: (a -> a') -> (a' -> a) -> f a -> f a' --- Invariant witnesses an Isomorphism-data Iso a b = Iso (a -> b) (b -> a)--invIso :: Invariant f => Iso a a' -> Iso (f a) (f a')+invIso :: Invariant f => Iso (->) a a' -> Iso (->) (f a) (f a') invIso (Iso f g)  = Iso (invmap f g) (invmap g f)  newtype FromFunctor f a = FromFunctor { runBi :: f a }
src/Data/Functor/Monoidal.hs view
@@ -5,17 +5,38 @@ import Control.Category.Tensor import Data.Void -class (Associative t1 cat, Associative t0 cat) => Semigroupal cat t1 t0 f where-  combine :: (f x `t0` f x') `cat` f (x `t1` x')--class Unital cat i1 i0 f where-  introduce :: i0 `cat` f i1-+-- | A <https://ncatlab.org/nlab/show/monoidal+functor Monoidal Functor> is a Functor between two Monoidal Categories+-- which preserves the monoidal structure. Eg., a homomorphism of+-- monoidal categories.+--+-- = Laws+-- Associativity:+--   combine (combine fx fy) fz ⟶ combine fx (combine fy fz)+--              ↓                         ↓+--   f (x `t1` y) `t1` fz         combine fx (f (y `t1` z))+--              ↓                         ↓+--   f ((x `t1` y) `t1` z)      ⟶ (f x `t1` (y `t1` z))+--+-- Left Unitality:+--   empty `t1` f x     ⟶  f empty `t1` f x+--         ↓                        ↓+--        f x           ←  f (empty `t0` x)+--+-- Right Unitality:+--   f x `t1` empty     ⟶  f x `t1` f empty+--         ↓                        ↓+--        f x           ←  f (x `t0` empty) class ( Tensor t1 i1 cat       , Tensor t0 i0 cat       , Semigroupal cat t1 t0 f       , Unital cat i1 i0 f       ) => Monoidal cat t1 i1 t0 i0 f++class (Associative t1 cat, Associative t0 cat) => Semigroupal cat t1 t0 f where+  combine :: (f x `t0` f x') `cat` f (x `t1` x')++class Unital cat i1 i0 f where+  introduce :: i0 `cat` f i1  -- TODO: Should we create an Apply class? instance Applicative f => Semigroupal (->) (,) (,) f where