This video introduces the idea of singleton types in languages like Scala, as well as all the kinds of singleton types we see in Scala code.
f you enjoyed this video, please like and subscribe, and hit the bell icon so you don't miss another one ;)
I'm on Twitter: / kubukoz
on GitHub: https://github.com/kubukoz
sometimes stream on Twitch: / kubukoz
And you can buy me a coffee if you want: https://ko-fi.com/kubukoz
Read the code:
https://github.com/kubukoz/videos/tre...
0:00 - Introduction, overview
0:34 - Singleton types - definition
1:49 - Unit as a singleton type
3:08 - Objects as singleton types
5:58 - Singleton types of values
7:17 - Singleton types of parameters
8:23 - Unions of singletons
9:31 - Literal singleton types
11:56 - Forcing type inference of singletons
13:35 - The ValueOf type class, valueOf
16:06 - singleton-ops demo
17:35 - Summary, parting words
Related libraries:
https://github.com/fthomas/singleton-ops
https://github.com/fthomas/refined
Find out more:
SIP-23 (original proposal to add literal singleton type syntax): https://docs.scala-lang.org/sips/42.t...
A great talk about SIP-23: • Literal types what they are good for by Ta...
Section on literal types in the Shapeless book: https://books.underscore.io/shapeless...
On this page of the site you can watch the video online Singleton types - Scala tutorial with a duration of hours minute second in good quality, which was uploaded by the user Jakub Kozłowski 17 September 2021, share the link with friends and acquaintances, this video has already been watched 1,430 times on youtube and it was liked by 62 viewers. Enjoy your viewing!