Invariant
public protocol Invariant
An Invariant Functor provides a type the ability to transform its value type into another type. An instance of Functor or Contravariant are Invariant Functors as well.
-
Transforms the value type using the functions provided.
The implementation of this function must obey the following laws:
imap(fa, id, id) == fa imap(imap(fa, f1, g1), f2, g2) == imap(fa, compose(f2, f1), compose(g2, g1))Declaration
Parameters
faValue whose value type will be transformed.
fTransforming function.
gTransforming function.
Return Value
A new value in the same context as the original value, with the value type transformed.
Install in Dash
Invariant Protocol Reference