Yoneda m >>= k = Yoneda (\f -> m id >>= \a -> runYoneda (k a) f)
I believe an alternative would be
Yoneda m >>= k = Yoneda (\f -> join . m $ \a -> runYoneda (k a) f)
The most obvious reason to prefer the current implementation is that it can take advantage of fmap id = id optimizations in some situations. Is this the only reason?
I believe an alternative would be
The most obvious reason to prefer the current implementation is that it can take advantage of
fmap id = id
optimizations in some situations. Is this the only reason?