Hello All,
Why does this compile
class Special a where
isSpecial :: a -> Bool
whereas, GHC 7.6 complains about this
class AlsoSpecial a where
isAlsoSpecial :: b -> Bool
This is the error message I get:
The class method `isAlsoSpecial'
mentions none of the type variables of the class AlsoSpecial a
When checking the class method:
isAlsoSpecial :: forall b. b -> Bool
In the class declaration for `AlsoSpecial'
My question is: Why must I use the type variable of the class declaration (i.e. *a*) in the type signature for the associated method? Is there a fundamental reason for this or is it just a GHC specific limitation? I didn't see a need for it when watching this video
http://channel9.msdn.com/posts/MDCC-TechTalk-Classes-Jim-but-not-as-we-know-them
that explains the translation that GHC does to turn type classes into core.
Thanks!
Dimitri
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners