diprism / perpl

The PERPL Compiler
MIT License
10 stars 5 forks source link

Parens in show #67

Closed davidweichiang closed 2 years ago

davidweichiang commented 2 years ago
-- parens.ppl
data Foo = foo Unit;
()
$ compiler.exe -c parens.ppl
data Foo = foo (Unit);

data Bool = False | True;

()
davidweichiang commented 2 years ago

I think if f is global then case f (let ...) of displays as case f let ... of.

davidweichiang commented 2 years ago

I added a bunch of test cases to look for problems with parse/show and I think I fixed all of them.

ccshan commented 2 years ago

Hi, sorry where are these test cases? Here's one more:

data Flip = H | T;
define flop =
  case fail of H -> \x. (case fail of H -> T
                                    | T -> H)
             | T -> \x. x;
()

I was thinking about organizing the Show precedence levels into a total order, but this case case seems a little special...

davidweichiang commented 2 years ago

tests/good/syntax_terms.ppl