diff --git a/theories/Structures/Applicative.v b/theories/Structures/Applicative.v index dd1d6669..65d3d5a6 100644 --- a/theories/Structures/Applicative.v +++ b/theories/Structures/Applicative.v @@ -1,3 +1,6 @@ +From ExtLib Require Import + Functor. + Set Implicit Arguments. Set Maximal Implicit Insertion. Set Universe Polymorphism. @@ -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.