Cagdas Ozgenc writes: | Greetings. | | How can I make all types that belong to class A and instance of | class B, if the implementations of functions in class B can be | realized by only using the functions in class A? | | Thanks for taking time.
Something like this, you mean? class A t where a::t class B t where b::t instance A t => B t where b = a That's not allowed in Haskell 98. Section 4.3.2 of the report says that the type in the instance declaration must consist of a type constructor applied to zero or more type variables, but in "instance ... => B t where ..." the type (t) is not of that form. Here are some ways to get around the restriction: - Remove class B, and turn its methods into ordinary functions with A in their contexts, or - Use an overlapping instances extension. I asked a similar question a couple of years ago. Here's the key response. http://www.mail-archive.com/haskell@haskell.org/msg05658.html Regards, Tom _______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe