When executing the IO action defined by someFun <$> (a :: IO ()) <$> (b :: IO ())
, is the execution of the a
and b
actions
Yes, the order is predefined by the Monad-Applicative correspondence. This is easy to see: The (*>)
combinator needs to correspond to the (>>)
combinator in a well-behaved Applicative
instance for a monad, and its definition is:
a *> b = liftA2 (const id) a b
In other words, if b
were executed before a
, the Applicative
instance would be ill-behaving.
Edit: As a side note: This is not explicitly specified anywhere, but you can find many other similar correspondences like liftM2
= liftA2
, etc.