[][src]Macro monadic::mdo

macro_rules! mdo {
    (pure $e:expr                           ) => { ... };
    (let $v:ident = $e:expr ; $($rest:tt)*) => { ... };
    (guard $boolean:expr ; $($rest:tt)*) => { ... };
    (_ <- $monad:expr ; $($rest:tt)* ) => { ... };
    (&$v:ident <- $monad:expr ; $($rest:tt)* ) => { ... };
    ($v:ident <- pure $e:expr ; $($rest:tt)* ) => { ... };
    ($v:ident <- $monad:expr ; $($rest:tt)* ) => { ... };
    ($monad:expr                            ) => { ... };
}

macro for iterables (IntoIterator) as monads enabling monad comprehensions over iterables

You can use:

  • pure return_expresion to return an expression value
  • monadic_expression to end with a monad expression
  • v <- pure return_expresion to lift a rhs expression value with Option::pure(x)
  • v <- monadic_expression to use the monad result
  • &v <- &container to use a reference item result from a by reference container
  • _ <- monadic_expression to ignore the monad result
  • let z = expression to combine monad results
  • guard boolean_expression to filter results