icicle-lang / icicle-ambiata

A streaming query language.
BSD 3-Clause "New" or "Revised" License
57 stars 11 forks source link

Pretty with annotations #631

Closed amosr closed 6 years ago

amosr commented 6 years ago

When prettying with annotations, we were annotating the return type of the let, instead of the binding type, which is kind of confusing. It was also printing the expressions in lets and folds without annotations, so I changed that. Also, there's not much point annotating monomorphic primitives. True:{Bool} is boring, but None:{Option Double} is interesting.

Example below. It's not as pretty because of the annotations inside the case, now, but I think it's more useful.

feature "injury"
~> let v:{ (Bool, Int) } =
     ((,):{ (Bool, Int) } True 1)
~> fold s2:{ Bool } =
     False : case:{ Element (Definitely Bool) } case:{ Element (Definitely Bool) } v:{ (Bool, Unit) }
     | (desugar_q-0, desugar_q-1) ->
         desugar_q-0:{ Element Bool }
     end
     | True ->
         False
     | False ->
         True
     end
~> s2:{ Aggregate (Definitely Bool) }

! @jystic @tranma /jury approved @jystic

tranma commented 6 years ago

so I think we decided to print without annotations in lets and folds in particular because they were very hard to read. You read this way more often though, so up to you.

Still would be nice to have an option to turn them off.

jacobstanley commented 6 years ago

Still would be nice to have an option to turn them off.

This looks like it's only when wrapped in PrettyAnnot so I think it's already the case that it's optional.

tranma commented 6 years ago

ah right, cool

jacobstanley commented 6 years ago

👍 on 🍇