Skip to content

Make `fmap` left associative.

Robbert Krebbers requested to merge fmap_assoc into master

This follows the associativity in Haskell. So, something like

f <$> g <$> h

Is now parsed as:

(f <$> g) <$> h

Since the functor is a generalized form of function application, this also now also corresponds with the associativity of function application, which is also left associative.

Todo

What should be the level? It used to be at level 60, which was already an arbitrary choice. However, this has to be changed since that level (60) is right associative. I tentatively put it at level 61, which is totally arbitrary too.

Clearly, the level should be above list append and cons (++ and ::, which are both at level 60). Things like f <$> xs ++ ys should be parsed as f <$> (xs ++ ys), similarly to what happens in Haskell. Are there other constraints? How should it interact with the monad notations (>>=, do notation, ...).

Merge request reports