logo       

bug: strange type class member accepted: msg#00072

lang.haskell.glasgow.bugs

Subject: bug: strange type class member accepted

Hi,

It appears that GHC 6.0 and 5.04.3 accept this code:

module Main where

class Foo a where
bug :: ()

-- main is not involved in the problem, just here for completeness
main :: IO ()
main = undefined

However, "bug" violates the requirement in the Report:

section 4.3.1 Class Declarations

class cx => C u where cdecls

The type of the top-level class method vi is:
vi :: forall u,w. (C u, cxi) =>ti
The ti must mention u;
^^^^

The type of "bug" does not mention the variable "a".

ghc/ghci accepts this code without error, or even warning, and it is even
possible
to make instances of this class.

However, there does not seem to be any way to use "bug" without getting
a type error, so I doubt this is a big problem in practice.

For comparison hugs reports a type error message.

Cheers,
Bernie.


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise