By the way is there any reason you couldn't attach laws to just like, a record of functions? Why are classes special?
Conversation
You're on to something very fundamental about type classes ;-)
1
1
What is it?
(Not sure if I should be thinking in the direction of "they're actually not special" or "they're more special than I think!")
2
1
Type classes are just a fancy, built-in way of passing records of functions around implicitly. Alas, they live in a separate language space.
1
2
I'm guessing you are already aware of this though 😉
1
2
1
3
I mean nothing too profound -- type classes tie "laws" to type-directed implicit arguments in a way that mystifies the two distinct concepts
2
4
in ML signatures specify an interface -- over both types and values -- and you can associate laws with the signature. much neater imo!
2
1
11
Tbh part of me regrets not having a sufficiently-strong set of counterarguments ready at the time, against the push for traits in Rust.
2
5
Tbh I do prefer the 'programming with interface constraints' feeling I get using TCs. I would prefer traditional TCs over ML modules…
3
1
For something like Eq, I really want implicit module passing. Damnnit if I'm gonna pass around/instantiate that module manually.
yup punting for so long on solving this problem properly (see also Standard ML's "eqtype" nonsense) is a big failing of the ML community
1
1
I think they've punted because the right answer is the kind of implicitness that ML people (such as ) dislike.
1
Show replies




