git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix an infinite search problem in entails due to module imports
commit31f8958d791bbe4e9d381ce39bbbc60b044b59d8 authorPhil Freeman <paf31@cantab.net> dateThu 3 Apr 2014, 23:49 (13 years ago) parent6d4cc4d
1 file changed+2−2
src/Language/PureScript/TypeChecker/Types.hs+2−2
src/Language/PureScript/TypeChecker/Types.hs+2−2
@@ -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