new Char()
The Char monoid. Char can be used to combine multiple items into a string
- Version:
- 3.0.0
- Source:
Example
const {Char} = require('futils').monoid;
Char('abc'); // -> Char('abc')
Char('abc').value; // -> 'abc'
Extends
- module:generics/Show
- module:generics/Eq
- module:generics/Ord
Methods
(static) empty() → {Char}
Monoid implementation for Char. Returns a Char of an empty string
- Source:
Returns:
- Type:
-
Char
The empty Char
Example
const {Char} = require('futils').monoid;
Char.empty(); // -> Char('')
(static) of(a) → {Char}
Lifts a value into a Char. Returns the empty Char for all values which are no strings
- Source:
Parameters:
Name | Type | Description |
---|---|---|
a |
any
|
The value to lift |
Returns:
- Type:
-
Char
A new Char
Example
const {Char} = require('futils').monoid;
Char.of('abc'); // -> Char('abc')
Char.of(null); // -> Char('')
Char.of({}); // -> Char('')
concat(a) → {Char}
Concatenates a Char with another using string concatenation
- Source:
Parameters:
Name | Type | Description |
---|---|---|
a |
Char
|
The Char instance to concatenate with |
Returns:
- Type:
-
Char
A new Char
Example
const {Char} = require('futils').monoid;
const ch = Char('a');
ch.concat(Char('b')); // -> Char('ab')