Can this function be implemented?

Is there any implementation for this function?

foo :: (Monad m, Monad n) => m a -> n a -> (a -> a -> a) -> m (n a)
foo x y f = ...
+4
source share
1 answer

Yes, and it can be assigned a more general type.

foo :: (Functor f, Functor g) => (a -> b -> c) -> f a -> g b -> f (g c)
foo f fx gy = fmap (\x -> fmap (f x) gy) fx
+12
source

Source: https://habr.com/ru/post/1656745/


All Articles