effekt-lang / effekt

A research language with effect handlers and lightweight effect polymorphism

Home Page:https://effekt-lang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pretty printing of Core does not group nested statements

phischu opened this issue · comments

Consider the following program:

def main() = {
  var i = 0;
  i = i + 1;
  ()
}

It gets transformed to the following Core:

def main751() =
  val tmp759763 = 0;
  var i750 = tmp759763 ;
  let tmp760764 = i750.get();
  let tmp765 = i750.put(infixAdd27(tmp760764, 1))
  
  tmp765;
  ()

This looked confusing to me at first. Inspecting the tree, the following would be clearer to me:

def main751() =
  val tmp759763 = 0;
  var i750 = tmp759763 ;
  val __766 = {
    let tmp760764 = i750.get();
    let tmp765 = i750.put(infixAdd27(tmp760764, 1));
    tmp765
  };
  ()

Alternatively the val __766 = could be left out since it is unused, but I like that it emphasizes that we are pushing a frame respectively generating a monadic bind here.