[Haskell-cafe] Typeclasses and instances

Benjamin Franksen benjamin.franksen at bessy.de
Thu Mar 17 15:33:01 EST 2005


On Thursday 17 March 2005 20:57, Mark Carroll wrote:
> Another note, with more help from friends:
>
> It turns out that GHC 6.4 will let me do,
>
> 	newtype Floating a => Test a = Test [a] deriving Show
>
> 	x = Test [False, True]
>
> but, if I change "newtype" to "data", it then says,
>
> 	No instance for (Floating Bool)
>
> I'm not sure I quite understand what's going on.

This looks like a bug to me. Regardless of whether Test is defined via 'data' 
or 'newtype', the definition of 'x' should not be accepted (assuming there is 
no 'instance Floating Bool' in scope).

Ben


More information about the Haskell-Cafe mailing list