[][src]Trait mini_haskell::utils::control::Maybe

pub trait Maybe {
    type Just;
    fn just(x: Self::Just) -> Self;
fn is_just(&self) -> bool;
fn into_optional(self) -> Option<Self::Just>; fn is_nothing(&self) -> bool { ... } }

Named after Maybe, Just, and Nothing from Haskell. Use this for success/failure semantics, since Either is used to model the control flow.

Associated Types

type Just

The success type in a Just.

Loading content...

Required methods

fn just(x: Self::Just) -> Self

Construct a success.

fn is_just(&self) -> bool

Check whether it is a success.

fn into_optional(self) -> Option<Self::Just>

Convert into an Option.

Loading content...

Provided methods

fn is_nothing(&self) -> bool

Check whether it is a failure.

Loading content...

Implementations on Foreign Types

impl<T> Maybe for Option<T>[src]

type Just = T

impl<T, E> Maybe for Result<T, E>[src]

type Just = T

Loading content...

Implementors

impl<T, E, M> Maybe for Result3<T, E, M>[src]

type Just = T

Loading content...