ekmett / ekmett/adjunctions

Adjunction f u means f a is isomorphic to (a, Rep u)

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

Description

There is an explicit isomorphism for this:

``` haskell
fromAdj :: Adjunction f u => f a -> (a, Rep u)
fromAdj = rightAdjunct (tabulate . (,))

toAdj :: Adjunction f u => a -> Rep u -> f a
toAdj = index . unit
```

And there should be a newtype wrapper, for instance named `Adj`, that works like `Co` in Data.Functor.Rep, and provides instances for Comonad, instances for Applicative and Monad when `Rep u` is a Monoid, etc. Also, there would be an Adjunction between `Adj f` and `Co u`, so that `Co u` has an Adjunction whenever u does.

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.