Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Isn't Applicative strong enough for MonadComprehensions? Why not?

Tags:

haskell

It strikes me that every monad comprehension ends in a return. Does that not effectively make them isomorphic to applicative programming? Why do we have monad comprehensions with a Monad constraint instead of applicative comprehensions with an Applicative constraint?

This do-like notation for Applicative similarly strikes me as very similar to monad comprehensions.

like image 330
Dag Avatar asked Sep 22 '12 17:09

Dag


1 Answers

No. You can write bind with monad comprehensions:

m >>= f == [ b | a <- m, b <- f a ]
like image 128
Sjoerd Visscher Avatar answered Nov 11 '22 11:11

Sjoerd Visscher