git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix #1175
522a99bPhil Freeman
examples/failing/1175.pursnew file+11
@@ -0,0 +1,11 @@
1+-- @shouldFailWith TypesDoNotUnify
2+module X where
3+
4+class Foo where
5+ foo :: String
6+
7+instance f :: Foo where
8+ foo = "a"
9+ where
10+ bar :: String
11+ bar = 1
src/Language/PureScript/Sugar/TypeDeclarations.hs+5−1
@@ -61,9 +61,13 @@ desugarTypeDeclarationsModule ms = forM ms $ \(Module ss coms name ds exps) ->
61 let (_, f, _) = everywhereOnValuesTopDownM return go return
61 let (_, f, _) = everywhereOnValuesTopDownM return go return
62 f' (Left gs) = Left <$> mapM (pairM return f) gs
62 f' (Left gs) = Left <$> mapM (pairM return f) gs
63 f' (Right v) = Right <$> f v
63 f' (Right v) = Right <$> f v
64− (:) <$> (ValueDeclaration name nameKind bs <$> f' val) <*> desugarTypeDeclarations rest
64+ (:) <$> (ValueDeclaration name nameKind bs <$> f' val)
65+ <*> desugarTypeDeclarations rest
65 where
66 where
66 go (Let ds val') = Let <$> desugarTypeDeclarations ds <*> pure val'
67 go (Let ds val') = Let <$> desugarTypeDeclarations ds <*> pure val'
67 go other = return other
68 go other = return other
69+ desugarTypeDeclarations (TypeInstanceDeclaration nm deps cls args (ExplicitInstance ds) : rest) =
70+ (:) <$> (TypeInstanceDeclaration nm deps cls args . ExplicitInstance <$> desugarTypeDeclarations ds)
71+ <*> desugarTypeDeclarations rest
68 desugarTypeDeclarations (d:ds) = (:) d <$> desugarTypeDeclarations ds
72 desugarTypeDeclarations (d:ds) = (:) d <$> desugarTypeDeclarations ds
69 desugarTypeDeclarations [] = return []
73 desugarTypeDeclarations [] = return []