Trait hetseq::Functor
[−]
[src]
pub trait Functor<F> { type Output; fn fmap(self, _: F) -> Self::Output; }
Functor over heterogenous list
Example
#![cfg_attr(feature="nightly", feature(unsize, fn_traits, unboxed_closures))] #[macro_use] extern crate hetseq; use hetseq::{Functor, Queue}; #[cfg(not(feature="nightly"))] use hetseq::F; use std::fmt::Display; lambda![ let Formatter = |const arg: Display| -> String { format!("{}", arg) } ]; fn main() { let queue = hqueue![1, 2.5]; let strings = queue.fmap(&Formatter); assert_eq!(strings, hqueue!["1".to_owned(), "2.5".to_owned()]); }
Associated Types
type Output
Result of mapping
Required Methods
Implementors
impl<F> Functor<F> for List<()>
impl<F> Functor<F> for Queue<()>
impl<X, H, T, O, U> Functor<X> for List<(H, List<T>)> where
List<T>: Functor<X, Output = List<U>>,
X: Fn<(H,), Output = O>,impl<X, H, T, O, U> Functor<X> for Queue<(Queue<H>, T)> where
Queue<H>: Functor<X, Output = Queue<U>>,
X: Fn<(T,), Output = O> + Clone,