named-implicit 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. It should be possible to refer to implicit arguments by name, to avoid having
  2. long sequences of {_}.
  3. Given
  4. f : {...}{A:Set} -> ...
  5. you should be able to say
  6. f {A = Nat}
  7. to give A explicitly. This should also work in patterns:
  8. f {A = A} = .. A ..
  9. How will this work exactly?
  10. At the moment we have the judgement form (checkArgs)
  11. Γ ⊢ es fits A ↓ vs
  12. with rules
  13. Γ ⊢ e ↑ A ─→ v Γ ⊢ es fits B[v/x]
  14. ----------------------------------
  15. Γ ⊢ e es fits (x:A)B ─→ v vs
  16. Γ ⊢ e es fits B[α/x]
  17. ----------------------------
  18. Γ ⊢ e es fits {x:A}B ─→ α vs
  19. Γ ⊢ e ↑ A ─→ v Γ ⊢ es fits B[v/x]
  20. ----------------------------------
  21. Γ ⊢ {e}es fits {x:A}B ─→ α vs
  22. Γ ⊢ ∙ fits B[α/x] ─→ vs
  23. -----------------------------
  24. Γ ⊢ ∙ fits {x:A} -> B ─→ α vs
  25. To this we add the rules
  26. Γ ⊢ e ↑ A ─→ v Γ ⊢ es fits B[v/x]
  27. ---------------------------------- (same as the {e}es rule)
  28. Γ ⊢ {x=e}es fits {x:A}B
  29. Γ ⊢ {x=e}es fits B[α/y] ─→ vs
  30. ------------------------------- (x ≠ y, similar to the 'e es fits {x:A}B' rule)
  31. Γ ⊢ {x=e}es fits {y:A}B ─→ α vs
  32. What about patterns? It would work exactly the same. I.e two new rules very
  33. similar to the '{p}ps' and 'p ps : {x:A}B' rules.