package monadlib

  1. Overview
  2. Docs

The list monad transformer will add non-determinism to computations. I have not provided a transformer for lazy lists, since I'm not yet sure how to implement it. It would probably need a lazy version of map_m, but it's not clear to me how to write this, since whether the computations are strict will determine whether the argument has to be completely forced.

Parameters

Signature

include Monad with type 'a m = 'a list M.m
include BatInterfaces.Monad with type 'a m = 'a list M.m
type 'a m = 'a list M.m

The type of a monad producing values of type 'a.

val bind : 'a m -> ('a -> 'b m) -> 'b m

Monadic binding.

bind m f executes first m then f, using the result of m.

include Applicative.Applicative with type 'a m := 'a m
include Applicative.Base with type 'a m := 'a m
val return : 'a -> 'a m
val (<*>) : ('a -> 'b) m -> 'a m -> 'b m
val lift1 : ('a -> 'b) -> 'a m -> 'b m
val lift2 : ('a -> 'b -> 'c) -> 'a m -> 'b m -> 'c m
val lift3 : ('a -> 'b -> 'c -> 'd) -> 'a m -> 'b m -> 'c m -> 'd m
val lift4 : ('a -> 'b -> 'c -> 'd -> 'e) -> 'a m -> 'b m -> 'c m -> 'd m -> 'e m
val (<$>) : ('a -> 'b) -> 'a m -> 'b m

Alias for lift1.

val sequence : 'a m list -> 'a list m
val map_a : ('a -> 'b m) -> 'a list -> 'b list m
val (<*) : 'a m -> 'b m -> 'a m
val (>*) : 'a m -> 'b m -> 'b m
val (>>=) : 'a m -> ('a -> 'b m) -> 'b m
val join : 'a m m -> 'a m
val filter_m : ('a -> bool m) -> 'a list -> 'a list m
val onlyif : bool -> unit m -> unit m
val unless : bool -> unit m -> unit m
val ignore : 'a m -> unit m
val lift : 'a M.m -> 'a m
OCaml

Innovation. Community. Security.