This is a pretty cool proposal for implicits in Gleam
Conversation
I'm still not sure this is the right direction for the language, but it's certainly a much better fit than type classes
3
1
Replying to
Modular implicits lets goooo. This is the way I'd like to add ad-hoc polymorphism to Pikelet (using dependent records for modules)!
If you do this, remember not to have complicated rules around disambiguating instances like in Scala – you should fail on any ambiguities.
But yeah, I'm definitely a fan of using modules/abstract datatypes for bounded polymorphism over traits/type classes. With instance parameters like in Agda and the Modular Implicits proposal for OCaml.
1
Replying to
100%! If Gleam gets something like this it'll be because I feel there's a design that is extremely predictable and quite easy to follow, even if that is at the expense of some expressive power.

