the-little-typer / pie

The Pie language, which accompanies The Little Typer by Friedman and Christiansen
http://thelittletyper.com/
GNU Affero General Public License v3.0
697 stars 57 forks source link

documenting check/synth of forms #3

Open pnwamk opened 6 years ago

pnwamk commented 6 years ago

In a previous discussion with @david-christiansen and @dfried00 there was a desire to have the documentation indicate which positions are visited in check-mode and which are visited in synthesis-mode by the type checker.

Would superscript "c" (for check) and "s" (for synthesis) on identifier names (with a comment at the top of the docs indicating their meaning) be a reasonable solution? e.g.:

image

david-christiansen commented 6 years ago

That could work.

What about, alternatively, replacing the :s below the description with for check or for synth? This matches notations used elsewhere, at least, but that might require more Scribble hacking.

david-christiansen commented 6 years ago

Also, how would you propose documenting check/synth for the resulting type? A superscript on the whole eliminator expression, or alternately the type after the arrow up top?

pnwamk commented 6 years ago

So, part of the reason I liked the initial solution I suggested is because I'm lazy and it was easy.

However, I really like your suggestion of (hopefully a little) hacking and making a scribble-like form that uses the double arrows, e.g.:

(iter-Nat target base step) ⇒ X
  target ⇐ Nat
  base ⇒ X
  step ⇐ (→ Nat X)

I wonder how difficult it would be...

david-christiansen commented 6 years ago

I imagine that something starting with a copy-paste of defform wouldn't be too hard, but that code is pretty abstracted and engineered...

xieyuheng commented 5 years ago

Why use the word synth or synthesis instead of infer ?

Does this choice have a reason ? If it does, I wish to learn :)

david-christiansen commented 5 years ago

I've seen both in the literature.

The reason I've come to prefer the term "synthesis" over "inference" in bidirectional type checking is to distinguish it from the more global type inference in Hindley-Milner-style systems. It seems to confuse somewhat fewer people, which makes me prefer it.