Crate frunk [] [src]

Frunk: generic functional programming toolbelt for Rust

Aims to be a collection of functional programming abstractions implemented in Rust in effective, useful, and idiomatic ways. Examples of things that are included in rust are:

  1. HLists (heterogeneously-typed lists)
  2. Validated (accumulator for Result)
  3. Semigroup
  4. Monoid

Here is a small taste of what Frunk has to offer:

use frunk::hlist::*;
use frunk::monoid::*;
use frunk::validated::*;

// Combining Monoids
let v = vec![Some(1), Some(3)];
assert_eq!(combine_all(&v), Some(4));

// HLists
let h = hlist![1, "hi"];
assert_eq!(h.length(), 2);
let hlist_pat!(a, b) = h;
assert_eq!(a, 1);
assert_eq!(b, "hi");Run

Links: 1. Source on Github 2. Crates.io page

Modules

hlist

Module that holds HList data structures and implementations

monoid

Module for holding Monoid typeclass definitions and default implementations

semigroup

Module for holding the Semigroup typeclass definition and typeclass instances

validated

Module for holding Validated logic

Macros

Hlist

Returns a type signature for an HList of the provided types

hlist

Returns an HList based on the values passed in.

hlist_pat

Macro for pattern-matching on HLists.