[Haskell-cafe] ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

Niemeijer, R.A. r.a.niemeijer at tue.nl
Mon Apr 20 03:27:05 EDT 2009

> data EShow = forall a. Show a => EShow a
> data E t = forall a. E (a->t) a
> smallPrint_ t = concatMap (\f-> f t) [show . foo, show . bar, show . baz]

Yeah, I am aware of these solutions, but like Dan says:

> but first-class existentials are still desirable because introducing a new 
> type for every existential is annoying. It's comparable to having to write a 
> new class for every combination of argument and result types to mimic first 
> class functions in Java (aside from first class functions being more 
> ubiquitous in their usefulness, although perhaps it only appears that way 
> because we don't have easy use of existential types).

I've personally always looked at the extra data type or repeated functions as ugly hacks around the fact that GHC doesn't have real existential typing. Since Haskell is otherwise virtually free of ugly hacks (at least at the level I work at, which doesn't require things like unsafePerformIO and unboxed arrays) this has always annoyed me a bit. So I figured that since we now have a working implementation it would be worth a shot to ask if this language wart can be removed from GHC.

More information about the Haskell-Cafe mailing list