~/talk

TwoFace values: a bridge between terms and types

Talkat Typelevel Summit Lausanne 2019 · on Friday, 2019-06-14· [scala]
name:Oron Port
speakerdeck:soronpo
slides:none on file

Scala 2.13 literal types plus the singleton-ops library let types and terms convert both ways: literal types, TwoFace values, compile-time checks, runtime fallback. The library uses whitebox macros to evaluate type-level math (plus, minus, comparisons, if-then-else) and provides TwoFace value classes so a fixed-size vector’s size can be computed and checked at compile time (falling back to a runtime exception if unknown), with examples that reject size 0 with the message "size must be positive". It notes symbol deprecation and partial Scala 3 support.

AI-written summary · about

  1. 0:00Introduction
  2. 1:10Scala 2.13 and singleton types
  3. 3:22Literal types and upper bounds
  4. 8:56Singleton type limitations
  5. 10:48Singleton ops library
  6. 12:11How singleton ops works
  7. 13:57Compile-time calculations with ops
  8. 17:15Compile-time constraints with ops
  9. 19:47Introducing TwoFace values
  10. 20:32Compile-time inlining with TwoFace
  11. 22:45TwoFace shells for compile-time
  12. 25:20Checked values with TwoFace
  13. 26:51Size and bounds checks with TwoFace
  14. 29:32Pitfalls and improvements
  15. 31:44Conclusion and future
  16. 32:05Acknowledgments and Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.