feat: simulation start
This commit is contained in:
parent
f90206e57e
commit
391e350315
18 changed files with 305 additions and 5 deletions
26
src/lib/common/monad.ml
Normal file
26
src/lib/common/monad.ml
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
module type Monad = sig
|
||||
type 'a t
|
||||
|
||||
val return : 'a -> 'a t
|
||||
val bind : 'a t -> ('a -> 'b t) -> 'b t
|
||||
end
|
||||
|
||||
module type FullMonad = sig
|
||||
type 'a t
|
||||
|
||||
val return : 'a -> 'a t
|
||||
val bind : 'a t -> ('a -> 'b t) -> 'b t
|
||||
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
|
||||
val (let*) : 'a t -> ('a -> 'b t) -> 'b t
|
||||
val join : 'a t t -> 'a t
|
||||
end
|
||||
|
||||
module Expand (M : Monad) = struct
|
||||
include M
|
||||
|
||||
let (>>=) = M.bind
|
||||
let (let*) = M.bind
|
||||
let join m = M.bind m (fun m -> m)
|
||||
end
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue