@@ -34,6 +34,7 @@ import Control.Applicative
3434import Control.Arrow (Arrow(..))
3535import Control.Monad.State
3636import Control.Monad.Error.Class (MonadError(..))
37+import Control.Monad.Writer.Class (tell)
3738
3839import Language.PureScript.AST
3940import Language.PureScript.Errors
@@ -83,7 +84,9 @@ entails env moduleName context = solve
8384 unique :: [(a, TypeClassDictionaryInScope)] -> Check (a, TypeClassDictionaryInScope)
8485 unique [] = throwError . errorMessage $ NoInstanceFound className' tys'
8586 unique [a] = return a
86− unique tcds | pairwise overlapping (map snd tcds) = throwError . errorMessage $ OverlappingInstances className' tys' (map (tcdName . snd) tcds)
87+ unique tcds | pairwise overlapping (map snd tcds) = do
88+ tell . errorMessage $ OverlappingInstances className' tys' (map (tcdName . snd) tcds)
89+ return (head tcds)
8790 | otherwise = return (minimumBy (compare `on` length . tcdPath . snd) tcds)
8891
8992 -- |
@@ -94,6 +97,8 @@ entails env moduleName context = solve
9497 overlapping :: TypeClassDictionaryInScope -> TypeClassDictionaryInScope -> Bool
9598 overlapping TypeClassDictionaryInScope{ tcdPath = _ : _ } _ = False
9699 overlapping _ TypeClassDictionaryInScope{ tcdPath = _ : _ } = False
100+ overlapping TypeClassDictionaryInScope{ tcdDependencies = Nothing } _ = False
101+ overlapping _ TypeClassDictionaryInScope{ tcdDependencies = Nothing } = False
97102 overlapping tcd1 tcd2 = tcdName tcd1 /= tcdName tcd2
98103
99104 -- Create dictionaries for subgoals which still need to be solved by calling go recursively