adjunctions
adjunctions copied to clipboard
Representable (Kleisli r a) given a phantom 'l' argument
Does this instance exist anywhere? F l r a b
is Kleisli r a b
with a phantom l
argument. It was inspired by the "In terms of representable functors" section.
type F :: (Type -> Type) -> (Type -> Type) -> Type -> (Type -> Type)
newtype F l r a b = F (a -> r b)
deriving Functor
via Kleisli r a
instance Adjunction l r => Distributive (F l r a) where
distribute :: Functor f => f (F l r a b) -> F l r a (f b)
distribute = distributeRep
instance Adjunction l r => Representable (F l r a) where
type Rep (F l r a) = l a
index :: F l r a b -> (l a -> b)
index (F f) = rightAdjunct f
tabulate :: (l a -> b) -> F l r a b
tabulate f = F (leftAdjunct f)