ekmett / ekmett/adjunctions

Representable (Kleisli r a) given a phantom 'l' argument

Open
#70 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
45
Forks
26
PR merge metrics
No merged PRs in 30d

Description

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"](https://ncatlab.org/nlab/show/adjoint+functor#InTermsOfRepresentableFunctors) section.

```haskell
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)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.