Skip to content

Instantly share code, notes, and snippets.

@quinn-dougherty
Created November 29, 2022 22:21
Show Gist options
  • Select an option

  • Save quinn-dougherty/04e5e8ee564a4604549914c258d48cea to your computer and use it in GitHub Desktop.

Select an option

Save quinn-dougherty/04e5e8ee564a4604549914c258d48cea to your computer and use it in GitHub Desktop.
function types form a monad in exactly one way. (this uses `coq-ext-lib` so you can't roll it in jscoq)
From ExtLib Require Import Monad.
Section ArrowMonad.
Context (A : Type).
Instance CodArrowMonad : Monad (fun B => A -> B).
Proof.
constructor.
- intros B y x.
apply y.
- intros B C alpha Beta x.
specialize (alpha x).
apply (Beta alpha x).
Defined.
(* TODO: impossibility proof of the `Monad (fun B => B -> A)`*)
End ArrowMonad.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment