Contents
- FunctorLaw <F>
- assert (K<F, int> fa, Func<K<F, int>, K<F, int>, bool>? equals = null)
- validate (K<F, int> fa, Func<K<F, int>, K<F, int>, bool>? equals = null)
- identityLaw (K<F, int> lhs, Func<K<F, int>, K<F, int>, bool> equals)
- compositionLaw ( K<F, int> fa, Func<int, int> f, Func<int, int> g, Func<K<F, int>, K<F, int>, bool> equals)
- Functor
- Functor <F>
Sub modules
| Extensions |
| Operators |
| Prelude |
class FunctorLaw <F> Source #
Functions that test that functor-laws hold for the F functor provided.
NOTE: Equals must be implemented for the K〈F, *〉 derived-type, so that the laws
can be proven to be true. If your functor doesn't have Equals then you must provide
the optional equals parameter so that the equality of outcomes can be tested.
Parameters
| type | F | Functor type |
Methods
method Unit assert (K<F, int> fa, Func<K<F, int>, K<F, int>, bool>? equals = null) Source #
Assert that the functor laws hold
NOTE: Equals must be implemented for the K〈F, *〉 derived-type, so that the laws
can be proven to be true. If your functor doesn't have Equals then you must provide
the optional equals parameter so that the equality of outcomes can be tested.
method Validation<Error, Unit> validate (K<F, int> fa, Func<K<F, int>, K<F, int>, bool>? equals = null) Source #
Validate that the functor laws hold
NOTE: Equals must be implemented for the K〈F, *〉 derived-type, so that the laws
can be proven to be true. If your functor doesn't have Equals then you must provide
the optional equals parameter so that the equality of outcomes can be tested.
method Validation<Error, Unit> identityLaw (K<F, int> lhs, Func<K<F, int>, K<F, int>, bool> equals) Source #
Validate the identity law
NOTE: Equals must be implemented for the K〈F, *〉 derived-type, so that the laws
can be proven to be true. If your functor doesn't have Equals then you must provide
the optional equals parameter so that the equality of outcomes can be tested.
method Validation<Error, Unit> compositionLaw ( K<F, int> fa, Func<int, int> f, Func<int, int> g, Func<K<F, int>, K<F, int>, bool> equals) Source #
Validate the composition law
NOTE: Equals must be implemented for the K〈F, *〉 derived-type, so that the laws
can be proven to be true. If your functor doesn't have Equals then you must provide
the optional equals parameter so that the equality of outcomes can be tested.
Functor module
Methods
method K<F, B> map <F, A, B> (Func<A, B> f, K<F, A> fa) Source #
Functor map. Maps all contained values of A to values of B
Parameters
| type | F | Functor trait |
| type | A | Bound value type |
| type | B | Resulting bound value type |
| param | f | Mapping function |
| param | fa | Functor structure |
| returns | Mapped functor | |
interface Functor <F> Source #
Functor trait
Map is used to apply a function of type Func〈A, B〉 to a value of type K〈F, A〉
where F is a functor, to produce a value of type K〈F, B〉.
Note that for any type with more than one parameter (e.g., Either), only the
last type parameter can be modified with Map (e.g. R in Either〈L, R〉).
Some types two generic parameters or more have a Bifunctor instance that allows both
the last and the penultimate parameters to be mapped over.
Parameters
| type | F | Self referring type |
Methods
method K<F, B> Map <A, B> (Func<A, B> f, K<F, A> ma) Source #
Functor map operation
Unwraps the value within the functor, passes it to the map function f provided, and
then takes the mapped value and wraps it back up into a new functor.
Parameters
| type | Fnctr | Trait of the functor |
| param | f | Mapping function |
| param | ma | Functor to map |
| returns | Mapped functor | |
method K<F, B> Map <A, B> (Func<A, B> f, Memo<F, A> ma) Source #
Functor map operation
Unwraps the value within the functor, passes it to the map function f provided, and
then takes the mapped value and wraps it back up into a new functor.
Parameters
| type | Fnctr | Trait of the functor |
| param | f | Mapping function |
| param | ma | Functor to map |
| returns | Mapped functor | |