Skip to content

Latest commit

 

History

History
94 lines (59 loc) · 2.49 KB

identity.md

File metadata and controls

94 lines (59 loc) · 2.49 KB

Identity

A Identity is another way of storing two values in a single value. Elements of a Identity do not need to be of the same type

Implements: Monad, Semigroup, Setoid

Identity(v)

Identity constructor

Param Type Description
v any Value to be wrapped by identity. This cannot be undefiend

Identity.of(v)

Identity constructor

Param Type Description
v any Value to be wrapped by identity. This cannot be undefiend

Identity.equals(j)

Check if the values of the current Identity is equal to the values of the passed Identity. This checkes for ==='ty of the values of the 2 Identities

Param Type Description
j Identity The Identity to compare with

Identity.concat( p)

Concat the current Identity with the passed one. Note that values of both the Identities should be of the same type and should be of type semigroup for cancat to work

Param Type Description
p Identity Identity to concat

Identity.getValue()

Get the value within the Identity

Identity.map(f)

Apply the function to the value of the current Identity

Param Type Description
f function Function

Identity.chain(f)

Chain a computation that returns an Identity

Param Type Description
f function Function that returns another Identity

Identity.toString()

Get a stringified version of the Identity


Examples

** TODO: Add some examples **