FR
PréludeChargé par défaut — aucun import nécessaire.

Monad — sequencing computations that depend on earlier results

Synopsis
interface Applicative f => Monad f where
(>>=) : f a -> (a -> f b) -> f b
(>>) : f a -> Lazy (f b) -> f b

An Applicative whose effects may depend on previously-computed values. (>>=) ("bind") runs a computation, then feeds its result to a function that produces the next computation. (>>) sequences two computations, discarding the first one's result; it has a default in terms of (>>=).

This is what the do block desugars to: do { x <- m; rest } ==> m >>= \x -> do { rest } do { m; rest } ==> m >> do { rest } The second argument of (>>) is Lazy (as in Idris 2): the first one may stop the sequence (Nothing, Left), and a definition can cite itself there.