
Hi, I have a test file: module Main where class A a where doSomething :: a -> IO () class B b where doMore :: b -> IO () instance B b => A b where doSomething = doMore instance A String where doSomething = putStrLn main = doSomething "Hello, World! So there is a class A, and a class B. If something is part of B it is automatically part of A (so A is kind of a superclass to B). But String is just part of A. I try to compile it with: ghc Test.hs -XFlexibleInstances -XUndecidableInstances I get: Test.hs:14:8: Overlapping instances for A [Char] arising from a use of `doSomething' Matching instances: instance B b => A b -- Defined at Test.hs:8:10 instance A String -- Defined at Test.hs:11:10 In the expression: doSomething "Hello, World!" In an equation for `main': main = doSomething "Hello, World!" Why are the instances overlapping? String is not part of B??? How can I do this? Thanks! Nathan