File tree Expand file tree Collapse file tree 2 files changed +18
-22
lines changed
Expand file tree Collapse file tree 2 files changed +18
-22
lines changed Original file line number Diff line number Diff line change @@ -2,12 +2,11 @@ Set Implicit Arguments.
22Set Strict Implicit .
33
44(** This class should be used when no requirements are needed * *)
5- Class Any (T : Type) : Type.
5+ Polymorphic Class Any (T : Type) : Type.
66
7- Global Instance Any_a (T : Type) : Any T.
7+ Global Polymorphic Instance Any_a (T : Type) : Any T.
88
9-
10- Definition RESOLVE (T : Type) : Type := T.
9+ Polymorphic Definition RESOLVE (T : Type) : Type := T.
1110
1211Existing Class RESOLVE.
1312
Original file line number Diff line number Diff line change @@ -3,28 +3,25 @@ Require Import ExtLib.Core.Any.
33Set Implicit Arguments .
44Set Strict Implicit .
55
6- Section functor.
7- Variable F : Type -> Type .
6+ Polymorphic Class Functor (F : Type @{d} -> Type ) : Type :=
7+ { fmap : forall {A B : Type@{d}}, (A -> B) -> F A -> F B } .
88
9- Class Functor : Type :=
10- { fmap : forall A B, (A -> B) -> F A -> F B } .
9+ Polymorphic Definition ID {T : Type @{d}} (f : T -> T) : Prop :=
10+ forall x, f x = x .
1111
12- Definition ID {T : Type } (f : T -> T) : Prop :=
13- forall x, f x = x.
12+ Polymorphic Class PFunctor (F : Type @{d} -> Type ) : Type :=
13+ { FunP : Type @{d} -> Type
14+ ; pfmap : forall {A B : Type@{d}} {P : FunP B}, (A -> B) -> F A -> F B
15+ }.
1416
15- Class PFunctor : Type :=
16- { FunP : Type -> Type
17- ; pfmap : forall {A B} {P : FunP B}, (A -> B) -> F A -> F B
18- }.
17+ Existing Class FunP.
18+ Hint Extern 0 (@FunP _ _ _) => progress (simpl FunP) : typeclass_instances.
1919
20- Existing Class FunP.
21- Hint Extern 0 (@FunP _ _ _) => progress (simpl FunP) : typeclass_instances.
22-
23- Global Instance PFunctor_From_Functor (F : Functor) : PFunctor :=
24- { FunP := Any
25- ; pfmap := fun _ _ _ f x => fmap f x
26- }.
27- End functor.
20+ Global Polymorphic Instance PFunctor_From_Functor
21+ (F : Type @{d} -> Type ) (FunF : Functor F) : PFunctor F :=
22+ { FunP := Any
23+ ; pfmap := fun _ _ _ f x => fmap f x
24+ }.
2825
2926Module FunctorNotation.
3027 Notation "f <$> x" := (@pfmap _ _ _ _ _ f x) (at level 51, right associativity).
You can’t perform that action at this time.
0 commit comments