Skip to content

Commit

Permalink
Applicative is Functor
Browse files Browse the repository at this point in the history
  • Loading branch information
liyishuai committed Dec 22, 2019
1 parent 8e1713c commit d97d562
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions theories/Structures/Applicative.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
From ExtLib Require Import
Functor.

Set Implicit Arguments.
Set Maximal Implicit Insertion.
Set Universe Polymorphism.
Expand All @@ -22,3 +25,13 @@ Section applicative.
Definition liftA@{d c} {T : Type@{d} -> Type@{c}} {AT:Applicative@{d c} T} {A B : Type@{d}} (f:A -> B) (aT:T A) : T B := pure f <*> aT.
Definition liftA2@{d c} {T : Type@{d} -> Type@{c}} {AT:Applicative@{d c} T} {A B C : Type@{d}} (f:A -> B -> C) (aT:T A) (bT:T B) : T C := liftA f aT <*> bT.
End applicative.

Section Instances.

Universe d c.
Context (T : Type@{d} -> Type@{c}) {AT : Applicative T}.

Global Instance Functor_Applicative@{} : Functor T :=
{ fmap := @liftA _ _ }.

End Instances.

0 comments on commit d97d562

Please sign in to comment.