adjunct : (L a → b) → (a → R b)
coadjunct : (a → R b) → (L a → b)
unit : a → RL a
counit : LR b → b
Lmap : (a → b) → (L a → L b)
Rmap : (a → b) → (R a → R b)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Bits | |
import Data.Foldable | |
{- | |
Two implementations of A372325 (https://oeis.org/A372325). | |
The first one ties the knot on the sequence itself, but needs the first | |
three values in order to get bootstrapped. | |
Using a cleverer takeWhile we could produce the first 0, but in order to | |
produce 2 we need to know that 1 isn't in the sequence, which we only |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Moved to https://agda.monade.li/NaiveFunext.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE BlockArguments #-} | |
import Control.Monad | |
import Data.Foldable | |
import Data.Map (Map) | |
import Data.Map qualified as Map | |
import Data.Set (Set) | |
import Data.Set qualified as Set | |
import Data.Sequence qualified as Seq | |
import Data.PriorityQueue.FingerTree qualified as PQ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Moved to https://agda.monade.li/Goat.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open import Cat.Functor.Naturality | |
open import Cat.Functor.Bifunctor | |
open import Cat.Functor.Coherence | |
open import Cat.Instances.Product | |
open import Cat.Functor.Compose | |
open import Cat.Diagram.Monad | |
open import Cat.Monoidal.Base | |
open import Cat.Functor.Base | |
open import Cat.Prelude |
instance Monoid a => MonadFix ((,) a) where
mfix :: (b -> (a, b)) -> (a, b)
mfix f = let (a, b) = f b in (a, b)
-- or
mfix f = fix (f . snd)
The laws are proved in section 4.5 of Value Recursion in Monadic Computations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Moved to https://agda.monade.li/TangentBundles.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Moved to https://agda.monade.li/FirstGroupCohomology.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Moved to https://agda.monade.li/MonoidalFibres.html |