Module frunk::semigroup
[−]
[src]
Module for holding the Semigroup typeclass definition and typeclass instances
You can, for example, combine tuples.
use frunk_core::hlist::*; use frunk::semigroup::*; let t1 = (1, 2.5f32, String::from("hi"), Some(3)); let t2 = (1, 2.5f32, String::from(" world"), None); let expected = (2, 5.0f32, String::from("hi world"), Some(3)); assert_eq!(t1.combine(&t2), expected); // ultimately, the Tuple-based combines are only available for a maximum of 26 elements. // if you need more, use HList, which is has no such limit. let h1 = hlist![1, 3.3, 53i64]; let h2 = hlist![2, 1.2, 1i64]; let h3 = hlist![3, 4.5, 54]; assert_eq!(h1.combine(&h2), h3) }Run
Structs
All |
Wrapper type for boolean that acts as a bitwise && combination |
Any |
Wrapper type for boolean that acts as a bitwise || combination |
Max |
Wrapper type for types that are ordered and can have a Max combination |
Min |
Wrapper type for types that are ordered and can have a Min combination |
Product |
Wrapper type for types that can have a Product combination |
Traits
Semigroup |
A Semigroup is a class of thing that has a definable combine operation |
Functions
combine_all_option |
Given a sequence of |
combine_n |
Return this combined with itself |