category 0.1.0.1 → 0.1.1.0
raw patch · 4 files changed
+37/−2 lines, 4 filesdep +alg
Dependencies added: alg
Files
- Data/Morphism/Endo.hs +16/−0
- Data/Morphism/Iso.hs +13/−0
- Prelude.hs +4/−1
- category.cabal +4/−1
+ Data/Morphism/Endo.hs view
@@ -0,0 +1,16 @@+module Data.Morphism.Endo where++import Algebra as A+import Control.Category.Groupoid as C++newtype Endo s a = Endo { endo :: s a a }+ deriving (Typeable)++instance Category s => Semigroup (Endo s a) where+ Endo f <> Endo g = Endo (f . g)++instance Category s => Monoid (Endo s a) where+ mempty = Endo id++instance Groupoid s => Group (Endo s a) where+ invert (Endo f) = Endo (C.invert f)
+ Data/Morphism/Iso.hs view
@@ -0,0 +1,13 @@+module Data.Morphism.Iso where++import Control.Category.Groupoid++data Iso s a b = Iso (s a b) (s b a)+ deriving (Typeable)++instance Category s => Category (Iso s) where+ id = Iso id id+ Iso f f' . Iso g g' = Iso (f . g) (g' . f')++instance Category s => Groupoid (Iso s) where+ invert (Iso f f') = Iso f' f
Prelude.hs view
@@ -2,10 +2,13 @@ module Data.Data, module Data.Either, module Data.Type.Equality,- module Data.Typeable) where+ module Data.Typeable,+ Semigroup (..), Monoid (..)) where import Control.Category import Data.Data import Data.Either+import Data.Monoid (Monoid (..))+import Data.Semigroup (Semigroup (..)) import Data.Type.Equality import Data.Typeable
category.cabal view
@@ -1,5 +1,5 @@ name: category-version: 0.1.0.1+version: 0.1.1.0 synopsis: Categorical types and classes -- description: license: BSD3@@ -14,8 +14,11 @@ library exposed-modules: Control.Category.Dual , Control.Category.Groupoid+ , Data.Morphism.Endo+ , Data.Morphism.Iso other-modules: Prelude build-depends: base >=4.10 && <5+ , alg >=0.2 && <0.3 default-language: Haskell2010 default-extensions: LambdaCase , PolyKinds