Skip to content

Commit 99f7abd

Browse files
committedJan 19, 2022
Move Data.Monads.ListMonad to Data.List
1 parent ea8a862 commit 99f7abd

File tree

3 files changed

+9
-20
lines changed

3 files changed

+9
-20
lines changed
 

‎_CoqProject

-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ theories/Data/Monads/FuelMonadLaws.v
119119
theories/Data/Monads/FuelMonad.v
120120
theories/Data/Monads/IdentityMonadLaws.v
121121
theories/Data/Monads/IdentityMonad.v
122-
theories/Data/Monads/ListMonad.v
123122
theories/Data/Monads/OptionMonadLaws.v
124123
theories/Data/Monads/OptionMonad.v
125124
theories/Data/Monads/ReaderMonadLaws.v

‎theories/Data/List.v

+9-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Global Instance Foldable_list@{u} {T : Type@{u}} : Foldable (list T) T :=
9898

9999
Require Import ExtLib.Structures.Traversable.
100100
Require Import ExtLib.Structures.Functor.
101-
Require Import ExtLib.Structures.Monad.
101+
Require Import ExtLib.Structures.Monads.
102102
Require Import ExtLib.Structures.Applicative.
103103

104104
Section traversable.
@@ -123,7 +123,14 @@ Monomorphic Universe listU.
123123
Global Instance Monad_list@{} : Monad@{listU listU} list :=
124124
{ ret := fun _ x => x :: nil
125125
; bind := fun _ _ x f =>
126-
List.fold_right (fun x acc => f x ++ acc) nil x
126+
flat_map f x
127+
}.
128+
129+
Global Instance MonadZero_list : MonadZero list :=
130+
{ mzero := @nil }.
131+
132+
Global Instance MonadPlus_list : MonadPlus list :=
133+
{ mplus _A _B a b := List.map inl a ++ List.map inr b
127134
}.
128135

129136
Section list.

‎theories/Data/Monads/ListMonad.v

-17
This file was deleted.

0 commit comments

Comments
 (0)