pakoito
01/27/2020, 4:46 PM// TODO which we need to have access to the implementation of map in Optionyes! it's also a fun exercise not to call
fix()
and see a stackoverflow exception because the function calls itselfJannis
01/27/2020, 4:54 PM.fix()
this can happen (if the ext. function is also on to Kind<*, *>
) ^^ Probably saved me many minutes of pointless staring at codeBruno
01/27/2020, 5:21 PMfun <F> parseInt(value: Kind<F, Int>, functor: Functor<F>) =
functor.run {
value.map { it.toInt() }
}
I have trouble with this run method...
If we had a way of saying Kind<F extends Functor, Int>
would it be possible to just say:
fun <F> parseInt(value: Kind<F extends Functor, Int>) = value.map { it.toInt() }
pakoito
01/27/2020, 9:27 PMFunctor<F>
proves that one existspakoito
01/27/2020, 9:28 PMpakoito
01/27/2020, 9:28 PMpakoito
01/27/2020, 9:29 PMF: Functor[_]
is in fact one way Scala does itpakoito
01/27/2020, 9:29 PMpakoito
01/27/2020, 9:29 PMfun <F> Functor<F>.parseInt(value: Kind<F extends Functor, Int>) =
pakoito
01/27/2020, 9:29 PMpakoito
01/27/2020, 9:29 PMBruno
01/28/2020, 10:02 AM