Haskell isn't 0-cost-abstraction like Rust ofc, but it is definitely a minimize-the-cost-of-abstraction. And the control over said minimization is getting better with each release.
Haskell isn't 0-cost-abstraction like Rust ofc, but it is definitely a minimize-the-cost-of-abstraction. And the control over said minimization is getting better with each release.
Higher rank types also break this, as you can define things like:
newtype GenericThing = GenericThing (forall a. [a] -> a)
doManyGenericThings :: [GenericThing] -> [a] -> [a]
doManyGenericThings things list = map (\GenericThing f -> f list) things
Here, `doManyGenericThings` takes a list of generic functions, and applies each of them to its argument. You can't just monomorphize it, because you'd have to somehow also monomorphize every argument it is ever passed, which is a dynamic property that you can't know in advance (and again, may not be a finite set).