Marius Jurgelenas & Karolis Masiulis
VilniusJs
2018
(x) => x
https://github.com/fantasyland/fantasy-land
map :: Functor f => f a ~> (a -> b) -> f b
u.map(a => a) === u
u.map(x => f(g(x))) === u.map(g).map(f)
Identity
Composition
[1,2,3].map(x => x + 1) // [2,3,4]
u.map(f)
of :: Applicative f => a -> f a
A value which has an Applicative must provide an of function on its type representative. The of function takes one argument:
F.of(a)
ap :: Apply f => f a ~> f (a -> b) -> f b
map :: Functor f => f a ~> (a -> b) -> f b
ap :: Apply f => f a ~> f (a -> b) -> f b
chain :: Chain f => f a ~> (a -> f b) -> f b
map :: Functor f => f a ~> (a -> b) -> f b
ap :: Apply f => f a ~> f (a -> b) -> f b
chain :: Chain f => f a ~> (a -> f b) -> f b
A Monad must implement the Applicative and Chain specifications.
There is one operation to manipulate values of the monad (chain), and an operation to put values into a monad (of)