35 lines
1.1 KiB
Haskell
35 lines
1.1 KiB
Haskell
module Functor.Exponent where
|
|
|
|
import Functor.Bifunctor
|
|
import Functor.Identity
|
|
import Functor.Product
|
|
import Relation
|
|
|
|
class Bifunctor f => InternalHom (f :: k -> k -> k) where
|
|
type Unit' f :: k
|
|
compose :: Object (Cod1 f) x -> Object (Cod1 f) y -> Object (Cod1 f) z -> Cod1 f (f y z) (f (f x y) (f x z))
|
|
identity :: Object (Cod1 f) x -> Cod1 f (Unit' f) (f x x)
|
|
abstract :: Cod1 f x (f (Unit' f) x)
|
|
apply :: Cod1 f (f (Unit' f) x) x
|
|
|
|
class (InternalHom hom, TensorProduct prod, Cod1 prod ~ Cod1 hom, Unit prod ~ Unit' hom) => MonoidalClosed hom prod where
|
|
curry :: Cod1 hom (hom (prod x y) z) (hom x (hom y z))
|
|
uncurry :: Cod1 hom (hom x (hom y z)) (hom (prod x y) z)
|
|
|
|
class (MonoidalClosed hom prod) => Exponential hom prod where
|
|
eval :: Cod1 hom (prod x (hom x y)) y
|
|
|
|
instance InternalHom (->) where
|
|
type Unit' (->) = ()
|
|
compose _ _ _ = (.)
|
|
identity _ _ = id
|
|
abstract = \x _ -> x
|
|
apply = \f -> f ()
|
|
|
|
instance MonoidalClosed (->) (,) where
|
|
curry = \f x y -> f (x, y)
|
|
uncurry = \f (x, y) -> f x y
|
|
|
|
instance Exponential (->) (,) where
|
|
eval = \(x, f) -> f x
|