[Haskell-cafe] About 'Overloaded functions are not your friend' line in GHC manual

Michail Pevnev mpevnev at gmail.com
Thu Jan 10 23:38:40 UTC 2019

Hello everyone.

I've been browsing through GHC manual some time ago, mostly to see what
extensions there are, and stumbled upon the following paragraph in the 'Advice
on: sooner, faster, smaller, thriftier' section, 'faster' subsection:

    Overloaded functions are not your friend:
    Haskell’s overloading (using type classes) is elegant, neat, etc., etc.,
    but it is death to performance if left to linger in an inner loop.

I don't quite understand the reason behind this. I was under impression that
function overloading - existential shenanigans aside - is resolved mostly at
compile time. Mostly, because obviously, say, 'show' for an Either still has to
examine its argument at runtime and pick appropriate 'show' for one of the
inner types. But the same happens for any examination of an Either, really.
Does overloading make it worse, and if so, how and why?

Or am I completely off track here, and the actual reason is something entirely


More information about the Haskell-Cafe mailing list