
On Wed, Dec 09, 2015 at 06:09:21AM +0100, martin wrote:
while learning about all the type classes and their relationships I came across something I found weird. If I understand it correctly, banana brackets where originally developed for Applicatives. The intent was to enable us to write something like
(| (\a b c -> a + b + c), [3], [1,2], [5,0,7] |)
and have it translated to
liftA3 (\a b c -> a + b + c) [3] [1,2] [5,0,7]
or alternatively, to allow us to write something like
(| (pure $ \a b c -> a + b + c), [3], [1,2], [5,0,7] |)
and have it translated directly to
pure (\a b c -> a + b + c) <*> [3] <*> [1,2] <*> [5,0,7]
A variant of banana brackets is implemented in ghc, but only for Arrows as part of -XArrowSyntax.
I don't think Arrow banana brackets are related to these Applicative (or "Idiom") brackets. Tom