@@ -291,14 +291,14 @@ data DictionaryValue
291291--
292292entails :: Environment -> ModuleName -> [TypeClassDictionaryInScope] -> (Qualified ProperName, [Type]) -> Check Value
293293entails env moduleName context goal@(className, tys) = do
294− case nub (go goal) of
294+ case go goal of
295295 [] -> throwError . strMsg $ "No instance found for " ++ show className ++ " " ++ unwords (map prettyPrintTypeAtom tys)
296296 [dict] -> return (dictionaryValueToValue dict)
297297 _ -> throwError . strMsg $ "Overlapping instances found for " ++ show className ++ " " ++ unwords (map prettyPrintTypeAtom tys)
298298 where
299299 go (className', tys') =
300300 [ mkDictionary (canonicalizeDictionary tcd) args
301− | tcd <- context
301+ | tcd <- nubBy ((==) `on` canonicalizeDictionary) context
302302 -- Choose type class dictionaries in scope in the current module
303303 , filterModule tcd
304304 -- Make sure the type class name matches the one we are trying to satisfy