git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Choose simplest superclass instance
commit1138e3b8dca957d765bfdea34b20aeca5082433d authorPhil Freeman <paf31@cantab.net> dateThu 20 Aug 2015, 15:32 (11 years ago) parentba585dc
2 files changed+3−3
examples/failing/438.purs+1−1 src/Language/PureScript/TypeChecker/Entailment.hs+2−2
examples/failing/438.purs+1−1
@@ -1,4 +1,4 @@
1−-- @shouldFailWith NoInstanceFound
1+-- @shouldFailWith PossiblyInfiniteInstance
22
33-- See issue 438 for details: this test is mainly here to test that code like
44-- this doesn't cause the compiler to loop.
src/Language/PureScript/TypeChecker/Entailment.hs+2−2
@@ -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