List types

Malcolm Wallace Malcolm.Wallace@cs.york.ac.uk
Mon, 4 Dec 2000 11:16:21 +0000


> You can't do it in standard Haskell, but with ghc extensions you can
> achieve the same effect.  For example, the following program
> 
> 	data Showable = forall a . Show a => Showable a
> 	instance Show Showable where
> 		show (Showable x) = show x
> 	example = map show [Showable 'a', Showable 5]
> 	main = print example
> 
> produces the output
> 
> 	["'a'","5"]

And it isn't just ghc that has this extension.  Hugs98 and nhc98
also implement it with this syntax.  Hbc has the extension too (local
forall quantification), but uses a slightly different syntax, since
its implementation pre-dates all the others.

Regards,
    Malcolm