Struct naan::impls::result::hkt::ResultOk

source ·
pub struct ResultOk<E>(_);
Expand description

core::result::Result lifted to an HKT1 with the error type pinned to some E.

(Kind Type -> Type)

Trait Implementations§

source§

impl<A, E> Alt<ResultOk<E>, A> for Result<A, E>

source§

fn alt(self, b: Self) -> Self

See Alt
source§

impl<A, E> Applicative<ResultOk<E>, A> for Result<A, E>

source§

fn pure(a: A) -> Result<A, E>

Lift A to F<A>
source§

impl<AB, E> Apply<ResultOk<E>, AB> for Result<AB, E>

source§

fn apply_with<A, B, Cloner>( self, a: <ResultOk<E> as HKT1>::T<A>, _: Cloner ) -> <ResultOk<E> as HKT1>::T<B>where AB: F1<A, Ret = B>, Cloner: for<'a> F1<&'a A, Ret = A>,

Apply the function A -> B contained in Self (F<A -> B>) to an instance of F<A> to get F<B>.
source§

fn apply<A, B>(self, a: F::T<A>) -> F::T<B>where Self: Sized, AB: F1<A, Ret = B>, A: Clone,

See [Apply.apply_with]
source§

impl<AB, E> ApplyOnce<ResultOk<E>, AB> for Result<AB, E>

source§

fn apply1<A, B>(self, a: Result<A, E>) -> Result<B, E>where AB: F1Once<A, Ret = B>,

source§

impl<A, E> Foldable<ResultOk<E>, A> for Result<A, E>

source§

fn foldl<B, BAB>(self, f: BAB, b: B) -> Bwhere BAB: F2<B, A, Ret = B>,

Fold the data structure from left -> right
source§

fn foldr<B, ABB>(self, f: ABB, b: B) -> Bwhere ABB: F2<A, B, Ret = B>,

Fold the data structure from right -> left
source§

fn foldl_ref<'a, B, BAB>(&'a self, f: BAB, b: B) -> Bwhere BAB: F2<B, &'a A, Ret = B>, A: 'a,

Fold the data structure from left -> right
source§

fn foldr_ref<'a, B, ABB>(&'a self, f: ABB, b: B) -> Bwhere ABB: F2<&'a A, B, Ret = B>, A: 'a,

Fold the data structure from right -> left
source§

fn fold_map<AB, B>(self, f: AB) -> Bwhere Self: Sized, AB: F1<A, Ret = B>, B: Monoid,

Fold the data structure, accumulating the values into a Monoid. Read more
source§

fn contains<'a>(&'a self, a: &'a A) -> boolwhere &'a A: PartialEq, A: 'a,

Test if the structure contains a value a Read more
source§

fn not_contains<'a>(&'a self, a: &'a A) -> boolwhere &'a A: PartialEq, A: 'a,

Test if the structure does not contain a value a Read more
source§

fn any<'a, P>(&'a self, f: P) -> boolwhere P: F1<&'a A, Ret = bool>, A: 'a,

Test if any element in the structure satisfies a predicate f Read more
source§

fn all<'a, P>(&'a self, f: P) -> boolwhere P: F1<&'a A, Ret = bool>, A: 'a,

Test if every element in the structure satisfies a predicate f Read more
source§

fn length(&self) -> usize

Get the number of elements contained within the structure Read more
source§

fn is_empty(&self) -> bool

Test if the structure is empty Read more
source§

fn find_map<AB, B>(self, f: AB) -> Option<B>where Self: Sized, AB: F1<A, Ret = Option<B>>,

Fold values until a match is found
source§

fn find<P>(self, f: P) -> Option<A>where Self: Sized, P: for<'a> F1<&'a A, Ret = bool>,

Fold values until a match is found
source§

impl<A, E> FoldableOnce<ResultOk<E>, A> for Result<A, E>

source§

fn fold1<B, BAB>(self, f: BAB, b: B) -> Bwhere BAB: F2Once<B, A, Ret = B>,

Fold the data structure
source§

fn fold1_ref<'a, B, BAB>(&'a self, f: BAB, b: B) -> Bwhere BAB: F2Once<B, &'a A, Ret = B>, A: 'a,

Fold the data structure
source§

fn get_or(self, a: A) -> Awhere Self: Sized,

Unwrap the data structure, using a provided default value if empty Read more
source§

impl<A, E> Functor<ResultOk<E>, A> for Result<A, E>

source§

fn fmap<AB, B>(self, f: AB) -> <ResultOk<E> as HKT1>::T<B>where AB: F1<A, Ret = B>,

Use a function from A -> B to transform an F<A> to an F<B>.
source§

impl<A, E> FunctorOnce<ResultOk<E>, A> for Result<A, E>

source§

fn fmap1<AB, B>(self, f: AB) -> Result<B, E>where AB: F1Once<A, Ret = B>,

source§

impl<E> HKT1 for ResultOk<E>

§

type T<A> = Result<A, E>

The generic type
source§

impl<A, E> Monad<ResultOk<E>, A> for Result<A, E>

source§

fn bind<B, AMB>(self, f: AMB) -> <ResultOk<E> as HKT1>::T<B>where AMB: F1<A, Ret = <ResultOk<E> as HKT1>::T<B>>,

See Monad
source§

fn flatten<AA>(self) -> M::T<AA>where Self: Sized, M: HKT1<T<AA> = A> + HKT1<T<<M as HKT1>::T<AA>> = Self>,

Flatten a nested Monad Read more
source§

impl<A, E> MonadOnce<ResultOk<E>, A> for Result<A, E>

source§

fn bind1<B, AMB>(self, f: AMB) -> Result<B, E>where AMB: F1Once<A, Ret = Result<B, E>>,

source§

fn discard<AMB, B>(self, f: AMB) -> M::T<A>where Self: Sized, B: Discard, AMB: for<'a> F1Once<&'a A, Ret = M::T<B>>, M::T<B>: MonadOnce<M, B>,

MonadOnce::bind1 that Discards the output of the function. Read more
source§

fn discard_mut<AMB, B>(self, f: AMB) -> M::T<A>where Self: Sized, B: Discard, AMB: for<'a> F1Once<&'a mut A, Ret = M::T<B>>, M::T<B>: MonadOnce<M, B>,

MonadOnce::discard with mutable access to the data Read more
source§

impl<A, B, E> Traversable<ResultOk<E>, A, B, ()> for Result<A, E>

source§

fn traversem1<Ap, AtoApOfB>( self, f: AtoApOfB ) -> Ap::T<<ResultOk<E> as HKT1>::T<B>>where Ap: HKT1, Ap::T<B>: Applicative<Ap, B> + ApplyOnce<Ap, B>, Ap::T<()>: Applicative<Ap, ()> + ApplyOnce<Ap, ()>, Ap::T<<ResultOk<E> as HKT1>::T<B>>: Applicative<Ap, <ResultOk<E> as HKT1>::T<B>> + ApplyOnce<Ap, <ResultOk<E> as HKT1>::T<B>>, AtoApOfB: F1<A, Ret = Ap::T<B>>,

Traverse a structure with 0 or more elements, collecting into an Applicative of 0 or 1 elements. Read more
source§

fn traversemm<Ap, AtoApOfB>( self, f: AtoApOfB ) -> Ap::T<<ResultOk<E> as HKT1>::T<B>>where Ap: HKT1, Ap::T<B>: Applicative<Ap, B>, Ap::T<()>: Applicative<Ap, ()>, Ap::T<<ResultOk<E> as HKT1>::T<B>>: Applicative<Ap, <ResultOk<E> as HKT1>::T<B>>, AtoApOfB: F1<A, Ret = Ap::T<B>>,

Traverse a structure with 0 or more elements, collecting into an Applicative of 0 or more elements.
source§

fn traverse<Ap, AtoApOfB>(self, f: AtoApOfB) -> Ap::T<F::T<B>>where Ap: HKT1, Self: Sized + Foldable<F, A>, Ap::T<B>: Applicative<Ap, B> + ApplyOnce<Ap, B>, Ap::T<TF>: Applicative<Ap, TF> + ApplyOnce<Ap, TF>, Ap::T<F::T<B>>: Applicative<Ap, F::T<B>> + ApplyOnce<Ap, F::T<B>>, AtoApOfB: F1<A, Ret = Ap::T<B>>, F: HKT1<T<A> = Self>,

source§

impl<A, B, E> TraversableOnce<ResultOk<E>, A, B, ()> for Result<A, E>where ResultOk<E>: HKT1<T<B> = Result<B, E>> + HKT1<T<A> = Result<A, E>>,

source§

fn traverse1m<Ap, AtoApOfB>(self, f: AtoApOfB) -> Ap::T<Result<B, E>>where Ap: HKT1, Ap::T<B>: Applicative<Ap, B>, Ap::T<Result<B, E>>: Applicative<Ap, Result<B, E>>, AtoApOfB: F1Once<A, Ret = Ap::T<B>>,

Traverse a structure with 0 or 1 elements, collecting into an Applicative of 0 or more elements.
source§

fn traverse11<Ap, AtoApOfB>(self, f: AtoApOfB) -> Ap::T<Result<B, E>>where Ap: HKT1, Ap::T<B>: Applicative<Ap, B> + ApplyOnce<Ap, B>, Ap::T<()>: Applicative<Ap, ()> + ApplyOnce<Ap, ()>, Ap::T<Result<B, E>>: Applicative<Ap, Result<B, E>> + ApplyOnce<Ap, Result<B, E>>, AtoApOfB: F1Once<A, Ret = Ap::T<B>>,

Traverse a structure with 0 or 1 elements, collecting into an Applicative of 0 or 1 elements. Read more
source§

fn traverse_swap<Ap, AtoApOfB>(self, f: AtoApOfB) -> Ap::T<F::T<B>>where Ap: HKT1, Self: Sized + FoldableOnce<F, A>, Ap::T<B>: Applicative<Ap, B> + ApplyOnce<Ap, B>, Ap::T<TF>: Applicative<Ap, TF> + ApplyOnce<Ap, TF>, Ap::T<F::T<B>>: Applicative<Ap, F::T<B>> + ApplyOnce<Ap, F::T<B>>, AtoApOfB: F1Once<A, Ret = Ap::T<B>>, F: HKT1<T<A> = Self>,

source§

fn traverse_replicate<Ap, AtoApOfB>(self, f: AtoApOfB) -> Ap::T<F::T<B>>where Ap: HKT1, Self: Sized + FoldableOnce<F, A>, Ap::T<B>: Applicative<Ap, B>, Ap::T<TF>: Applicative<Ap, TF>, Ap::T<F::T<B>>: Applicative<Ap, F::T<B>>, AtoApOfB: F1Once<A, Ret = Ap::T<B>>, F: HKT1<T<A> = Self>,

Auto Trait Implementations§

§

impl<E> RefUnwindSafe for ResultOk<E>where E: RefUnwindSafe,

§

impl<E> Send for ResultOk<E>where E: Send,

§

impl<E> Sync for ResultOk<E>where E: Sync,

§

impl<E> Unpin for ResultOk<E>where E: Unpin,

§

impl<E> UnwindSafe for ResultOk<E>where E: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<F, A, TF, T> Sequence<F, A, TF> for T

source§

fn sequence<Ap>(self) -> Ap::T<F::T<A>>where Self: Sized + Traversable<F, Ap::T<A>, A, TF> + Foldable<F, Ap::T<A>>, Ap: HKT1, Ap::T<A>: Applicative<Ap, A> + ApplyOnce<Ap, A>, Ap::T<TF>: Applicative<Ap, TF> + ApplyOnce<Ap, TF>, Ap::T<F::T<A>>: Applicative<Ap, F::T<A>> + ApplyOnce<Ap, F::T<A>>, F: HKT1<T<Ap::T<A>> = Self>,

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.