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::prelude::*;
 
use std::fmt::Display;
lambda![ let Formatter = |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

Result of mapping

Required Methods

Map sequence using Function

Implementors