Enum List

Source
pub enum List<A> {
    Nil,
    Cons {
        head: A,
        tail: Rc<List<A>>,
    },
}

Variants§

§

Nil

§

Cons

Fields

§head: A
§tail: Rc<List<A>>

Implementations§

Source§

impl<A: Clone> List<A>

Source

pub fn drop(self, n: u32) -> Self

Source

pub fn reverse(&self) -> Self

Trait Implementations§

Source§

impl<A> Apply for List<A>

Source§

type Elm = A

Source§

type M<U> = List<U>

Source§

fn ap<B, F>(self, fs: Self::M<F>) -> Self::M<B>
where F: Fn(&A) -> B, List<B>: Stack<B>,

Source§

impl<A: Clone> Bind for List<A>

Source§

type Elm = A

Source§

type M<U> = List<U>

Source§

fn bind<B, F>(self, f: F) -> List<B>
where F: Fn(&A) -> List<B>,

Source§

impl<A: Clone> Clone for List<A>

Source§

fn clone(&self) -> List<A>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<A: Debug> Debug for List<A>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<A> Empty for List<A>

Source§

fn empty() -> List<A>

Source§

fn is_empty(&self) -> bool

Source§

impl<A: Clone> Foldable for List<A>

Source§

type Elm = A

Source§

fn fold_left<B, F>(&self, b: B, f: F) -> B
where F: Fn(B, &Self::Elm) -> B,

Source§

fn fold_right<B, F>(&self, b: B, f: F) -> B
where F: Fn(&Self::Elm, B) -> B,

Source§

impl<A: Clone> From<Vec<A>> for List<A>

Source§

fn from(vec: Vec<A>) -> Self

Converts to this type from the input type.
Source§

impl<A: Clone> Functor for List<A>

Source§

type Elm = A

Source§

type M<U> = List<U>

Source§

fn fmap<B, F>(self, f: F) -> List<B>
where F: Fn(&A) -> B, List<B>: Stack<B>,

Source§

impl<A: Clone> Into<Vec<A>> for List<A>

Source§

fn into(self) -> Vec<A>

Converts this type into the (usually inferred) input type.
Source§

impl<A: PartialEq> PartialEq for List<A>

Source§

fn eq(&self, other: &List<A>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<A> Pure for List<A>

Source§

type Elm = A

Source§

type M<U> = List<U>

Source§

fn pure(value: A) -> List<A>

Source§

fn unit() -> Self::M<()>

Source§

impl<A> Semigroup for List<A>

Source§

fn combine(self, other: Self) -> Self

Source§

impl<A> Stack<A> for List<A>

Source§

fn cons(self, value: A) -> Self

Source§

fn head(&self) -> Result<&A, StackError>

Source§

fn tail(&self) -> Rc<Self>

Source§

fn size(&self) -> usize

Source§

fn update(self, index: u32, new_value: A) -> Result<Self, StackError>
where Self: Sized,

Source§

fn get(&self, index: u32) -> Result<&A, StackError>

Source§

impl<A> Applicative for List<A>

Source§

impl<A: Eq> Eq for List<A>

Source§

impl<A: Clone> Monad for List<A>

Source§

impl<A> Monoid for List<A>

Source§

impl<A> StructuralPartialEq for List<A>

Auto Trait Implementations§

§

impl<A> Freeze for List<A>
where A: Freeze,

§

impl<A> RefUnwindSafe for List<A>
where A: RefUnwindSafe,

§

impl<A> !Send for List<A>

§

impl<A> !Sync for List<A>

§

impl<A> Unpin for List<A>
where A: Unpin,

§

impl<A> UnwindSafe for List<A>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.