nicopasso
07/10/2020, 11:40 AMmap2
with the two Kleisli instances I’ve created, readNameKCO
and readAgeKCO
. My goal is to create a new Kleisli that generates a Person
instance from a Config
one and then using it with personK.run(config)
. I’m doing something wrong for sure but I don’t quite understand out to build the personK
Kleislijulian
07/12/2020, 10:07 PMJannis
07/12/2020, 10:38 PMmap2
's signature is: Kind<F, A>.map2(fb: Kind<F, B>, f: (A, B) -> C): Kind<F, C>
. This means it is not related to tuples directly. Instead you should use it as readNameKCO.map2(readAgeKCO) { (name, age) -> ... }
There is also mapN
which is a little nicer:
mapN(readNameKCO, readAgeKCO) { (name, age) -> ... }
nicopasso
07/13/2020, 9:13 AM