git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix an infinite search problem in entails due to module imports
31f8958Phil Freeman
src/Language/PureScript/TypeChecker/Types.hs+2−2
@@ -291,14 +291,14 @@ data DictionaryValue
291--
291--
292entails :: Environment -> ModuleName -> [TypeClassDictionaryInScope] -> (Qualified ProperName, [Type]) -> Check Value
292entails :: Environment -> ModuleName -> [TypeClassDictionaryInScope] -> (Qualified ProperName, [Type]) -> Check Value
293entails env moduleName context goal@(className, tys) = do
293entails env moduleName context goal@(className, tys) = do
294− case nub (go goal) of
294+ case go goal of
295 [] -> throwError . strMsg $ "No instance found for " ++ show className ++ " " ++ unwords (map prettyPrintTypeAtom tys)
295 [] -> throwError . strMsg $ "No instance found for " ++ show className ++ " " ++ unwords (map prettyPrintTypeAtom tys)
296 [dict] -> return (dictionaryValueToValue dict)
296 [dict] -> return (dictionaryValueToValue dict)
297 _ -> throwError . strMsg $ "Overlapping instances found for " ++ show className ++ " " ++ unwords (map prettyPrintTypeAtom tys)
297 _ -> throwError . strMsg $ "Overlapping instances found for " ++ show className ++ " " ++ unwords (map prettyPrintTypeAtom tys)
298 where
298 where
299 go (className', tys') =
299 go (className', tys') =
300 [ mkDictionary (canonicalizeDictionary tcd) args
300 [ mkDictionary (canonicalizeDictionary tcd) args
301− | tcd <- context
301+ | tcd <- nubBy ((==) `on` canonicalizeDictionary) context
302 -- Choose type class dictionaries in scope in the current module
302 -- Choose type class dictionaries in scope in the current module
303 , filterModule tcd
303 , filterModule tcd
304 -- Make sure the type class name matches the one we are trying to satisfy
304 -- Make sure the type class name matches the one we are trying to satisfy