jstolarek / slicer

Companion code for paper "Imperative Functional Programs that Explain their Work", Wilmer Ricciotti, Jan Stolarek, Roly Perera and James Cheney, ICFP 2017, Oxford, UK
http://dl.acm.org/citation.cfm?id=3110258
GNU General Public License v3.0
6 stars 0 forks source link

Operators bind tighter than function application #30

Open jstolarek opened 7 years ago

jstolarek commented 7 years ago

If I say

fst (raise "foo") + 2

this parses as fst ((raise "foo") + 2) rather than (fst (raise "foo")) + 2. I've run into similar issues several times before. The problem is that operators bind tighter than application but it should be the other way around. Perhaps this can be solved by modifying the parser. If not then we might need a separate pass to restore correct operator precedence (I think GHC does something like that).

jamescheney commented 7 years ago

Ugh, yeah. I now remember running into this and thinking it would be good to fix sometime...