git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix type class issue with synonyms
commit7cf48f0250c4a072822029a3ce19eb76c4242268 authorPhil Freeman <paf31@cantab.net> dateTue 22 Sep 2015, 20:09 (11 years ago) parent72ce900
1 file changed+6−2
src/Language/PureScript/TypeChecker/Entailment.hs+6−2
src/Language/PureScript/TypeChecker/Entailment.hs+6−2
@@ -75,10 +75,14 @@ entails env moduleName context = solve
7575 go :: Int -> Qualified ProperName -> [Type] -> Check DictionaryValue
7676 go work className' tys' | work > 1000 = throwError . errorMessage $ PossiblyInfiniteInstance className' tys'
7777 go work className' tys' = do
78+ -- We need to desugar synonyms here so that forClassName can find the correct modules
79+ -- in types hidden inside the synonyms.
80+ -- TODO: this can go away when synonyms get desugared up front.
81+ tys'' <- mapM expandAllTypeSynonyms tys'
7882 let instances = do
79− tcd <- forClassName className' tys'
83+ tcd <- forClassName className' tys''
8084 -- Make sure the type unifies with the type in the type instance definition
81− subst <- maybeToList . (>>= verifySubstitution) . fmap concat $ zipWithM (typeHeadsAreEqual moduleName env) tys' (tcdInstanceTypes tcd)
85+ subst <- maybeToList . (>>= verifySubstitution) . fmap concat $ zipWithM (typeHeadsAreEqual moduleName env) tys'' (tcdInstanceTypes tcd)
8286 return (subst, tcd)
8387 (subst, tcd) <- unique instances
8488 -- Solve any necessary subgoals