[Haskell-beginners] Heterogenous list implemented with GADT
koverton at lab49.com
Thu Sep 30 15:08:01 EDT 2010
Hello fellow beginners (and the rest of you, too), I was reading http://en.wikibooks.org/wiki/Haskell/GADT and I really liked the simple eval example. But I reached the end and was confused by the following definition of a heterogenous list:
data TG2 where
MkTG2 :: Show b => [b] -> TG2
I had thought a heterogeneous list was something like
[ 5 , 'Z', 3.14, False ]
How can the TG2 definition support the list I've given above? Or am I just wrong about what a heterogeneous list is?
This email and any attachments may contain information which is confidential and/or privileged. The information is intended exclusively for the addressee and the views expressed may not be official policy, but the personal views of the originator. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents is prohibited. If you have received this email and any file transmitted with it in error, please notify the sender by telephone or return email immediately and delete the material from your computer. Internet communications are not secure and Lab49 is not responsible for their abuse by third parties, nor for any alteration or corruption in transmission, nor for any damage or loss caused by any virus or other defect. Lab49 accepts no liability or responsibility arising out of or in any way connected to this email.
More information about the Beginners