[Haskell-cafe] Monad vs ArrowChoice

Twan van Laarhoven twanvl at gmail.com
Wed May 14 19:43:18 EDT 2008


Ronald Guida wrote:
> I have read that Monad is stronger than Idiom because Monad lets me
> use the results of a computation to choose between the side effects of
> alternative future computations, while Idiom does not have this
> feature.  Arrow does not have this feature either.
> 
> ArrowChoice has the feature that the sum type, Either, can be used to
> choose between alternative computations, including their side effects.
>  I know that Monad is supposed to be stronger than ArrowChoice, but I
> have to ask, what exactly can Monad do that ArrowChoice can't do?

Monads are equivalent to ArrowApply, they allow you to use a computed *action*. 
For example:

     getMissileLauncher :: IO (String -> IO ())

     notWithArrows = do
          launchMissiles <- getMissleLauncher
          launchMissiles "Russia"

ArrowChoice is not enough to implement this function. But it is possible with 
ArrowApply, of which Kleisli IO is an instance.

Twan


More information about the Haskell-Cafe mailing list