raulraja
10/29/2018, 4:19 PMfun <F, A, B> Kind<F, A>.map(f: (A) -> B, with F: Functor<F>): Kind<F, B> =
map(f)
value.map { it + 1 }
In regard to Set
. Set should not map
and get back a Set because it can’t form a lawful Functor
instance since it can’t guarantee order. More info here https://gist.github.com/tpolecat/7401433#file-gistfile1-scala
What we can do though is work on the SortedSetK
instances that are currently missing and that are similar to the ones we have for SortedMapK
where you can have a functor instance and provide a proper map
.