- Objects
- Arrows
- Source object
- Target object
- Rules
- Identity
- Arrow where source = target
- Composition
- if f: X -> Y and g: Y -> Z, then h: X -> Z = g . f
- Associativity
- if f: A -> B and g: B -> C and h: C -> D, then (h . g) . f = h . (g . f)
- Identity
Category with a single object.
trait Monoid[A] {
def identity: A
def compose(x: A, y: A): A
}
class Monoid a where
mempty :: a
mappend :: a -> a -> a
Objects that implement map.
class Functor f where
fmap :: (a -> b) -> f a -> f b