This is a followup to my old questions:
I know that monads are not composable, i.e. if M1[_]
and M2[_]
are monads M2[M1[_]]
is not necessarily a monad. For instance, List[Int]
and Option[Int]
are monads but Option[List[Int]]
is not automatically a monad and therefore I need a monad transformer
to use it as a monad (as in here)
I know that applicative functors are composable. I guess it means that if A1[_]
and A2[_]
are applicatives then A2[A1[_]]
is always an applicative. Is it correct ?
Could you provide an example of such a composition when A1
is List
and A2
is Option
? Could you give an example of other applicatives composed ?