Тёмный

Phantom Types and the Builder Pattern in Gleam • Hayleigh Thompson FOSDEM '24 

Hayleigh Thompson
Подписаться 95
Просмотров 3,2 тыс.
50% 1

Опубликовано:

 

27 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 9   
@lpil
@lpil 7 месяцев назад
Bravo!
@jleahr
@jleahr 6 месяцев назад
Congrats!!! really nice explanation of phantom types and gleam typing amazing language
@leepowelldev
@leepowelldev 5 месяцев назад
Would phantoms types be considered similar to branded types?
@SimGunther
@SimGunther 5 месяцев назад
5:05 Isn't that why there are labeled parameters in the language to prevent this positional programming folly? In fact, at 12:40, it could be argued that labeled parameters & default values would also the builder pattern not too relevant had it not been for opaque types.
@hayleigh-dot-dev
@hayleigh-dot-dev 5 месяцев назад
Yeah labels can definitely help you distinguish parameters when they're all the same type, for sure! Labels are more about readability than correctness, though, and the compiler can never save if you get the *labels* the wrong way round. I don't think you should reach for this approach with phantom types for *everything* but it is definitely useful to have a way to express "structurally identical, nominally distinct"
@Blubb3rbub
@Blubb3rbub 6 месяцев назад
I would like if there was a phantom type for integers that has information if a number can be 0 or not. So division could force you to check for != 0 at compile time.
@BooBoo314159
@BooBoo314159 6 месяцев назад
That can be made in your programs. I've thinking recently whether I should try to make a small package for this kind of things... I just don't know if it worth it, as one can just make their own custom types for this 😕
@lancemarchetti8673
@lancemarchetti8673 6 месяцев назад
Brilliant
@bcpeinhardt
@bcpeinhardt 7 месяцев назад
The builder pattern application is really cool. I guess you could finagle it to be a convenient way to handle conditionally required fields as well 🤔
Далее
Building a Redis clone from scratch in Gleam
5:04:09
Просмотров 9 тыс.
Avaz Oxun - Yangisidan bor
14:29
Просмотров 388 тыс.
Watermelon magic box! #shorts by Leisi Crazy
00:20
+1000 Aura For This Save! 🥵
00:19
Просмотров 8 млн
The Only Database Abstraction You Need | Prime Reacts
21:42
Nix explained from the ground up
23:39
Просмотров 32 тыс.
Andrew Kelley   Practical Data Oriented Design (DoD)
46:40
My 10 “Clean” Code Principles (Start These Now)
15:12
Avaz Oxun - Yangisidan bor
14:29
Просмотров 388 тыс.