Does GHC use dynamic dispatch with existential types?
问题 Does the following bit of code use dynamic dispatch as it's understood in C++ or Java? As I understand, at the last line, compiler cannot possibly know at compile time which implementation of (==) to call, yet the code compiles and produces correct results. Can someone please explain, what kind of implementation (vptr, for example) lies behind this? {-# LANGUAGE ExistentialQuantification #-} data Value = A Int data ForallFunc = forall a. Eq a => Forall (Value -> a) unpackA (A int) = int