Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Yeah, that was silly of me
True, but just in case ;)
Simple example:
bimap (+ 10) (* 13) (7, 3) = (17, 39)
So,
(bimap f g (a,b))
appliesf
toa
, andg
tob
, while maintaining the tuple structure.Another example, but with
Either
:Now, a clever trick is to apply
join
tobimap
. It happens to be the case thatjoin bimap
applies the same function to both parts of a tuple:The reason this works is due to the definition of
join
and the monad instance for functions (i.e.(->) r
):Thank you! It's so satisfying to lay things out his way :)
Same here. The random test fails with the undecypherable:
Falsifiable (after 4 tests and 6 shrinks): expected: Just 0 but got: Nothing "a" Positive {getPositive = 1} -1
What am I supposed to do with that? ...