bug with rank n polymorphism in classes

Hal Daume III hdaume at ISI.EDU
Thu Aug 22 15:47:29 EDT 2002


consider:

module Foo where

class Foo p where
    foo :: p -> (forall q . Foo q => q -> a) -> a

instance Foo Int where


if you load this in to ghci, it complains:

/home/hdaume/projects/NLP/Foo.hs:6:
    Ambiguous type variable(s) `q' in the constraint `Foo q'
    arising from a function with an overloaded argument type at
/home/hdaume/projects/NLP/Foo.hs:6
	Expected type: Int -> (forall q1. (Foo q1) => q1 -> a) -> a
	Inferred type: Int -> (q -> a) -> a
    In the application `GHC.Err.noMethodBindingError
"/home/hdaume/projects/NLP/Foo.hs:6|Foo.foo"#'

which is a reasonable complaint, but is emiited in a rather bizzare way.

--
Hal Daume III

 "Computer science is no more about computers    | hdaume at isi.edu
  than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume




More information about the Glasgow-haskell-bugs mailing list