Created
July 11, 2012 04:42
-
-
Save tonymorris/3088073 to your computer and use it in GitHub Desktop.
Semigroup/Monoid/Semigroupoid/Category/Endo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Semigroupoid cat where | |
(<.>) :: | |
cat a b | |
-> cat b c | |
-> cat a c | |
class Semigroupoid cat => Category cat where | |
identity :: | |
cat a a | |
class Semigroup s where | |
(<>) :: | |
s | |
-> s | |
-> s | |
class Semigroup s => Monoid s where | |
zero :: | |
s | |
newtype Endo hom a = Endo (hom a a) | |
instance Semigroupoid hom => Semigroup (Endo hom a) where | |
Endo x <> Endo y = | |
Endo (x <.> y) | |
instance Category hom => Monoid (Endo hom a) where | |
zero = | |
Endo identity |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment