empty

Function empty 

Source
pub fn empty<M: Monoid>() -> M
Expand description

The identity element.

Free function version that dispatches to the type class’ associated function.

§Type Signature

forall a. Monoid a => () -> a

§Type Parameters

  • M: The type of the monoid.

§Returns

The identity element.

§Examples

use fp_library::classes::monoid::empty;
use fp_library::types::string; // Import Monoid impl for String

let x: String = empty();
assert_eq!(x, "".to_string());