[Haskell-cafe] Why this doesn't type checked

Martijn van Steenbergen martijn at van.steenbergen.nl
Mon Jun 28 06:05:49 EDT 2010


On 6/27/10 21:52, Victor Nazarov wrote:
 >> class Sizeable sizeable
 >>    where type Sizeof sizeable
 >>          sizeof :: Sizeof sizeable

This is where the type checker should complain. There is no valid way to 
call sizeof, regardless of what instances are available.

The situation is similar to this:

 > class C a where x :: Int

In which case the compiler says:

 >     The class method `x'
 >     mentions none of the type variables of the class C a
 >     When checking the class method: x :: Int
 >     In the class declaration for `C'

I thought there was already a trac ticket for this, but I can't find it 
right now.

Martijn.


More information about the Haskell-Cafe mailing list