Type Classes and the StdEnv

Nick Kallen phantom@earthlink.net
Thu, 27 Nov 1997 13:49:52 -0800


I have another question:

To use Arjan's example, why wont the following work:?

module a
import StdEnv

incAll xs = map` inc xs

Start = incAll []

class Map f where
     map` :: (a -> b) (f a) -> f b

instance Map [] where
     map` f xs = map f xs

The overloading on [] is unresolvable... It could be [Int], [Real],
watevever--but if the definition of map is looked at, it could care less
about what type [] is: (map _ [] = []). Shouldn't the compiler be able to
recognize -this- atleast? NO type informtion is needed.