by zenhack · 6y ago · 0 comments
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).