git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Another small corner case of #390
23c679fPhil Freeman
examples/passing/UnknownInTypeClassLookup.pursnew file+12
@@ -0,0 +1,12 @@
1+module Main where
2+
3+class EQ a b
4+
5+instance eqAA :: EQ a a
6+
7+test :: forall a b. (EQ a b) => a -> b -> String
8+test _ _ = "Done"
9+
10+runTest a = test a a
11+
12+main = Debug.Trace.trace $ runTest 0
src/Language/PureScript/TypeChecker/Types.hs+1
@@ -421,6 +421,7 @@ pairwise p (x : xs) = all (p x) xs && pairwise p xs
421-- Check that two types unify
421-- Check that two types unify
422--
422--
423unifiesWith :: Environment -> Type -> Type -> Bool
423unifiesWith :: Environment -> Type -> Type -> Bool
424+unifiesWith _ (TUnknown u1) (TUnknown u2) | u1 == u2 = True
424unifiesWith _ (Skolem _ s1 _) (Skolem _ s2 _) | s1 == s2 = True
425unifiesWith _ (Skolem _ s1 _) (Skolem _ s2 _) | s1 == s2 = True
425unifiesWith _ (TypeVar v1) (TypeVar v2) | v1 == v2 = True
426unifiesWith _ (TypeVar v1) (TypeVar v2) | v1 == v2 = True
426unifiesWith _ (TypeConstructor c1) (TypeConstructor c2) | c1 == c2 = True
427unifiesWith _ (TypeConstructor c1) (TypeConstructor c2) | c1 == c2 = True