Skip to content

Applicative Comprehensions

As discussed on ghc-devs, when both the MonadComprehensions and ApplicativeDo language extensions are enabled, it should be possible to use comprehension-notation (in addition to do-notation) for Applicatives. This would allow, for example, an expression like

(\x y -> x + 2*y) <$> ZipList [1..10] <*> ZipList [10,20..100]

to also be written as

[ x + 2*y | x <- ZipList [1..10], y <- ZipList [10,20..100] ]
Edited by Thomas Miedema
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information