@@ -78,8 +78,8 @@ entails env moduleName context = solve
7878 unique :: [(a, TypeClassDictionaryInScope)] -> Check (a, TypeClassDictionaryInScope)
7979 unique [] = throwError . errorMessage $ NoInstanceFound className' tys'
8080 unique [a] = return a
81− unique xs@(x : _) | pairwise overlapping (map snd xs) = throwError . errorMessage $ OverlappingInstances className' tys' (map (tcdName . snd) xs) -- TODO: use simplest instance
82− | otherwise = return x
81+ unique tcds | pairwise overlapping (map snd tcds) = throwError . errorMessage $ OverlappingInstances className' tys' (map (tcdName . snd) tcds)
82+ | otherwise = return (minimumBy (compare `on` length . tcdPath . snd) tcds)
8383
8484 -- |
8585 -- Check if two dictionaries are overlapping