File tree Expand file tree Collapse file tree 7 files changed +15
-9
lines changed
Expand file tree Collapse file tree 7 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ Section except.
7070 }.
7171
7272 Global Instance MonadT_eitherT : MonadT eitherT m :=
73- { lift := fun _ c => mkEitherT (liftM ret c) }.
73+ { lift := fun _ c => mkEitherT (liftM inr c) }.
7474
7575 Global Instance MonadState_eitherT {T} (MS : MonadState T m) : MonadState T eitherT :=
7676 { get := lift get
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ Section Trans.
5454 { mzero _A := mkOptionT (ret None) }.
5555
5656 Global Instance MonadT_optionT : MonadT optionT m :=
57- { lift _A aM := mkOptionT (liftM ret aM) }.
57+ { lift _A aM := mkOptionT (liftM Some aM) }.
5858
5959 Global Instance State_optionT {T} (SM : MonadState T m) : MonadState T optionT :=
6060 { get := lift get
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ Class Applicative@{d c} (T : Type@{d} -> Type@{c}) :=
1010; ap : forall {A B : Type@{d}}, T (A -> B) -> T A -> T B
1111}.
1212
13+ Global Hint Mode Applicative ! : typeclass_instances.
14+
1315Module ApplicativeNotation.
1416 Notation "f <*> x" := (ap f x) (at level 52, left associativity).
1517End ApplicativeNotation.
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ Set Strict Implicit.
66Polymorphic Class Functor@{d c} (F : Type @{d} -> Type @{c}) : Type :=
77{ fmap : forall {A B : Type@{d}}, (A -> B) -> F A -> F B }.
88
9+ Global Hint Mode Functor ! : typeclass_instances.
10+
911Polymorphic Definition ID@{d} {T : Type @{d}} (f : T -> T) : Prop :=
1012 forall x : T, f x = x.
1113
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ Class Monad@{d c} (m : Type@{d} -> Type@{c}) : Type :=
1010; bind : forall {t u : Type@{d}}, m t -> (t -> m u) -> m u
1111}.
1212
13+ Global Hint Mode Monad ! : typeclass_instances.
14+
1315Section monadic.
1416
1517 Definition liftM@{d c}
Original file line number Diff line number Diff line change @@ -40,9 +40,9 @@ Section MonadLaws.
4040 Context {S : Type}.
4141
4242 Class MonadStateLaws (MS : MonadState S m) : Type :=
43- { get_put : bind get put = ret tt
43+ { get_put : bind get put = ret tt :> m unit
4444 ; put_get : forall x : S,
45- bind (put x) (fun _ => get) = bind (put x) (fun _ => ret x)
45+ bind (put x) (fun _ => get) = bind (put x) (fun _ => ret x) :> m S
4646 ; put_put : forall {A} (x y : S) (f : unit -> m A),
4747 bind (put x) (fun _ => bind (put y) f) = bind (put y) f
4848 ; get_get : forall {A} (f : S -> S -> m A),
Original file line number Diff line number Diff line change @@ -10,13 +10,13 @@ Polymorphic Class Traversable@{d r} (T : Type@{d} -> Type@{r}) : Type :=
1010}.
1111
1212Polymorphic Definition sequence@{d r}
13- {T : Type @{d} -> Type @{d }}
13+ {T : Type @{d} -> Type @{r }}
1414 {Tr:Traversable T}
15- {F : Type @{d} -> Type @{d }} {Ap:Applicative F} {A : Type @{d}}
16- : T (F A) -> F (T A) := mapT (@id _ ).
15+ {F : Type @{d} -> Type @{r }} {Ap:Applicative F} {A : Type @{d}}
16+ : T (F A) -> F (T A) := mapT (@id (F A) ).
1717
1818Polymorphic Definition forT@{d r}
19- {T : Type @{d} -> Type @{d }}
20- {Tr:Traversable T} {F : Type @{d} -> Type @{d }} {Ap:Applicative F}
19+ {T : Type @{d} -> Type @{r }}
20+ {Tr:Traversable T} {F : Type @{d} -> Type @{r }} {Ap:Applicative F}
2121 {A B : Type @{d}} (aT:T A) (f:A -> F B) : F (T B)
2222:= mapT f aT.
You can’t perform that action at this time.
0 commit comments