lux/control/monad

Types

Monad

(sig: (Monad m)
  (: (lux/control/applicative;Applicative m)
     applicative)
   (: (All [b] (-> (m (m b)) (m b)))
     join))

Macros

do

## Macro for easy concatenation of monadic operations.
(do Monad<Maybe>
  [y (f1 x)
   z (f2 z)]
  (wrap (f3 z)))

Values

(foldM monad f init xs)

Fold a list with a monad-producing function.

(All [a b c] (-> (Monad a) (-> c b (a b)) b (lux;List c) (a b)))

(liftM Monad<M> f)

Lift a normal function into the space of monads.

(All [a b c] (-> (Monad a) (-> b c) (a b) (a c)))

(mapM monad f xs)

Apply a monad-producing function to all values in a list.

(All [a b c] (-> (Monad a) (-> b (a c)) (lux;List b) (a (lux;List c))))

(seqM monad xs)

Run all the monadic values in the list and produce a list of the base values.

(All [a b] (-> (Monad a) (lux;List (a b)) (a (lux;List b))))