12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576(** Module types related to monads *)(** Module type of a plain monad *)moduletypeMonad=sig(** ['a t] is the type of computations of type ['a] *)type'at(** ['a res] is the outcome of running a computation of type ['a] *)type'ares(** [return x] injects a value [x] as a computation *)valreturn:'a->'at(** Monadic bind *)valbind:'at->('a->'bt)->'bt(** Functorial map *)valmap:'at->('a->'b)->'bt(** Running a monadic computation *)valrun:'at->'aresmoduleInfix:sig(** Alias to [bind]. *)val(>>=):'at->('a->'bt)->'bt(** Alias to [map]. *)val(>|=):'at->('a->'b)->'bt(** Alias to [bind]. *)val(let*):'at->('a->'bt)->'bt(** Convenience reexport of [return]. *)valreturn:'a->'atendend(** Monad dedicated to handling computations spanning several stages *)moduletypeCodegen_monad=sig(** ['a m] is the type of generated programs of type ['a] *)type'am(** ['a t] is the type of computations of type ['a] *)type'atvalreturn:'a->'atvalbind:'at->('a->'bt)->'btvalrun:'amt->'amvallift1:('a->'b)->'at->'btvallift2:('a->'b->'c)->'at->'bt->'ctvallift3:('a->'b->'c->'d)->'at->'bt->'ct->'dtmoduleInfix:sig(** Alias to [bind]. *)val(>>=):'at->('a->'bt)->'bt(** Alias to [bind]. *)val(let*):'at->('a->'bt)->'btval(>>):unitmt->(unit->'at)->'at(** [let*! x = m in f] uses the target language binding construct
to bind [x] to [m] and passes x to the continuation [f].
In contrast to [let* x = return m in f], this has the effect
of not duplicating [m] at each use site. *)val(let*!):'am->('am->'bt)->'btval(>>!):unitm->(unit->'bt)->'btendend