If only it were that easy. Sadly, it's not. Let's look at the following example:
data Test = Test { foo :: Int, bar :: Char, baz :: Bool }
smallPrint t = concatMap (\f -> show $ f t) [foo, bar, baz]
In this code the list [foo, bar, baz] should have the type [exists a. Show a =>
Test -> a].
If we explicitly specify the type, replacing the exists with a forall, then GHC
complains about not being able to match Int, Char and Bool against type a.
Forall is not the same as exists and GHC only implements the former.
________________________________________
From: Bulat Ziganshin [[email protected]]
Sent: 19 April 2009 22:07
To: Niemeijer, R.A.
Cc: [email protected]
Subject: Re[2]: [Haskell-cafe] ANNOUNCE: Utrecht Haskell Compiler (UHC) --
first release
Hello R.A.,
Sunday, April 19, 2009, 11:46:53 PM, you wrote:
> Does anybody know if there are any plans to incorporate some of
> these extensions into GHC - specifically the existential typing ?
it is already here, but you should use "forall" keyword instead odf
"exists"
--
Best regards,
Bulat
mailto:[email protected]_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe