[Haskell-beginners] forall confusion
Philip Scott
haskell-beginners at foo.me.uk
Sat May 29 11:35:42 EDT 2010
Hi all,
I was wondering if someone could give me an intuitive explanation of why in
f :: forall a.(Show a) => a -> String
f x = show x
"forall a.(Show a) => a" appears to translate into "Any a, as long as it
is an instance of Show"
but if I use forall in an type qualifier in an assignment:
myList = [] :: [forall a.(Show a) => a]
"forall a.(Show a) => a" seems to mean "Any a, as long as it is bottom"
I've been poring over
http://en.wikibooks.org/wiki/Haskell/Existentially_quantified_types
for the last hour and I feel like my eyes are starting to melt.
As usual, any input would be warmly received :)
All the best,
Philip
More information about the Beginners
mailing list