Conversation

I feel like I don't have a lot of examples of languages where a wrapper on an entity is routinely passed around as a proxy for the entity itself except for the ones in the same "we decided to make a mass-market version of OCaml around 2015" cohort as Rust.
1
1
(...Similarly the more conventional ML have the Tag(entity) vs entity problem, but those languages seem to really dislike subtyping (ie concepts such as traits) so they can't get into this particular hole so easily.)
1
1
Actually, I wonder if Haskell has variants of this problem (because typeclasses are not completely dissimilar from traits), and what their current error message is.
1
2
traits *are* typeclasses, they follow p much all the same formalisms etc. I saw this tweet out of order and forgot to reply to it, sorry but yeah, one could translate my playground examples into Haskell, and I would if I knew a Haskell playground (and weren't passing out tired)
1
1
and this is if I change it to: `foo :: Foo -> ()` nothing amazing, really, I wonder if I should try Elixir or whatever that language is that was praised for its diagnostics
Image
1
1
Elm doesn't have ad-hoc polymorphism, except for hard-wired `comparable` and `number` type parameters, so it probably won't be super helpful. Haskell does have a nice way of providing domain-specific error messages for type classes though. Not sure if it would help here though.
2