
So, consider this code: import Data.HashTable as HT class MyClass a where htLookup :: a -> String -> IO String type Context = HT.HashTable String String instance MyClass Context where htLookup h var = do result <- HT.lookup h var case result of Nothing -> return "" Just s -> return s This doesn't compile. GHC says: Illegal instance declaration for `MyClass Context' (The instance type must be of form (T a b c) where T is not a synonym, and a,b,c are distinct type variables) In the instance declaration for `MyClass Context' If I use "data" instead of "type", it works: data Context = C (HT.HashTable String String) instance MyClass Context where htLookup (C h) var = do result <- HT.lookup h var case result of Nothing -> return "" Just s -> return s Why? What's going on here? JCAB