3 ms·
The beginner isn't defining the instances. But the experts want the flexibility to define such instances, and that means even beginner code can involve an unhel
by momentoftop 7y ago
The beginner isn't defining the instances. But the experts want the flexibility to define such instances, and that means even beginner code can involve an unhelpful amount of polymorphism. This isn't the case in Rust, where literals are near enough monomorphic.
There's a similar situation with the now classic:
Prelude> length ['a','b']
2
Prelude> length ('a','b')
1
Here, beginners are potentially being burned by the fact that "length" is polymorphic with the type:
length :: Foldable f => f a -> Int
which is not a type I want to explain to beginners. At the same time, as an expert, I want length to be polymorphic and don't want to sacrifice its polymorphism for the sake of beginners.
- Quekid5 7y agoI don't think that's an example of what was being talked about, but... I appreciate the issue. I think I've even been bitten by this once! I think the problem there is really calling it 'length'.