Composing Kleisli's with andThen isn't possible when the functor is Validated[X, ?] even though validated has an andThen method.
This is because Kleisli's andThen is an alias for flatMap and requires a FlatMap instance but Validated doesn't have a FlatMap instance (rightly so).
I don't know if it's reasonable, but there could be an AndThen type class in the same manner as FlatMap. The laws could be the same and for the vast majority of the instances the andThen method would just alias to flatMap. A default internal AndThenIsFlatMap trait could bake this into existing FlatMap instances. I don't know if this has any broader benefit outside of fixing the issue described above.
Composing Kleisli's with
andThenisn't possible when the functor isValidated[X, ?]even though validated has anandThenmethod.This is because Kleisli's
andThenis an alias forflatMapand requires aFlatMapinstance butValidateddoesn't have aFlatMapinstance (rightly so).I don't know if it's reasonable, but there could be an
AndThentype class in the same manner asFlatMap. The laws could be the same and for the vast majority of the instances theandThenmethod would just alias toflatMap. A default internalAndThenIsFlatMaptrait could bake this into existingFlatMapinstances. I don't know if this has any broader benefit outside of fixing the issue described above.