[Haskell-cafe] <**> for nested applicative functors?

Josef Svenningsson josef.svenningsson at gmail.com
Mon Oct 12 12:31:55 EDT 2009


On Mon, Oct 12, 2009 at 6:22 PM, Kim-Ee Yeoh <a.biurvOir4 at asuhan.com> wrote:
>
> Does anyone know if it's possible to write the following:
>
> <**> :: (Applicative m, Applicative n) =>
> m (n (a->b)) -> m (n a) -> m (n b)
>
> Clearly, if m and n were monads, it would be trivial.
>
> Rereading the original paper, I didn't see much discussion
> about such nested app. functors.
>
> Any help appreciated.
>
How about

m <**> n = pure (<*>) <*> m <*> n

Hth,

Josef


More information about the Haskell-Cafe mailing list