Skip to content

Commit 027479b

Browse files
committed
Move Data.Monads.ListMonad to Data.List
1 parent ca0795c commit 027479b

File tree

3 files changed

+11
-23
lines changed

3 files changed

+11
-23
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

+11-5
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.
@@ -120,10 +120,16 @@ Global Instance Traversable_list@{} : Traversable list :=
120120

121121
Monomorphic Universe listU.
122122

123-
Global Instance Monad_list@{} : Monad@{listU listU} list :=
124-
{ ret := fun _ x => x :: nil
125-
; bind := fun _ _ x f =>
126-
List.fold_right (fun x acc => f x ++ acc) nil x
123+
Global Instance Monad_list : Monad list :=
124+
{ ret := fun _ v => v :: nil
125+
; bind := fun _ _ l f => flat_map f l
126+
}.
127+
128+
Global Instance MonadZero_list : MonadZero list :=
129+
{ mzero := @nil }.
130+
131+
Global Instance MonadPlus_list : MonadPlus list :=
132+
{ mplus _A _B a b := List.map inl a ++ List.map inr b
127133
}.
128134

129135
Section list.

theories/Data/Monads/ListMonad.v

-17
This file was deleted.

0 commit comments

Comments
 (0)