aelve / haskell-issues

An unofficial issue tracker for all things Haskell-related
18 stars 0 forks source link

ghc: Unbalance operator precedence #34

Open Gurkenglas opened 8 years ago

Gurkenglas commented 8 years ago

If we could have an operator (§) = ($) with highest precedence to the left and lowest precedence to the right, as if we ran a preprocessor parsing pass over the .hs and replaced every § with brackets over all of its right side, we would have a general solution to https://github.com/aelve/haskell-issues/issues/24 , where . is replaced by any other operator, because we could write:

foo = asd . evalState § do
  dsa
  sda

Note an objection: [ Just use parentheses.

GHC is terrible enough in its support of ($) in order to avoid parentheses, please do not extend that pattern.](http://ircbrowse.net/browse/haskell?id=22423655×tamp=1457611719#t1457611719)
Gurkenglas commented 8 years ago

Also asd >>= evalStateT § do dsa; sda, or >=> in >>='s place. Perhaps also foo .= § f . g $ a instead of foo .= (f . g $ a) (although of course in this particular example foo .= f (g a) is probably better?)