git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix #1664, check kind before expanding wildcards.
521d20ePhil Freeman
examples/passing/1664.pursnew file+16
@@ -0,0 +1,16 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff
5+import Control.Monad.Eff.Console
6+
7+data Identity a = Identity a
8+
9+newtype IdentityEff e a = IdentityEff (Eff e (Identity a))
10+
11+test :: forall e a. IdentityEff e a -> IdentityEff e Unit
12+test (IdentityEff action) = IdentityEff $ do
13+ (Identity x :: Identity _) <- action
14+ return $ Identity unit
15+
16+main = log "Done"
src/Language/PureScript/TypeChecker/Types.hs+2−2
@@ -406,9 +406,9 @@ inferBinder val (PositionedBinder pos _ binder) =
406-- change the definition of `binderRequiresMonotype`,
406-- change the definition of `binderRequiresMonotype`,
407-- and use `kindOfWithScopedVars`.
407-- and use `kindOfWithScopedVars`.
408inferBinder val (TypedBinder ty binder) = do
408inferBinder val (TypedBinder ty binder) = do
409+ kind <- kindOf ty
410+ checkTypeKind ty kind
409 ty1 <- replaceAllTypeSynonyms <=< replaceTypeWildcards $ ty
411 ty1 <- replaceAllTypeSynonyms <=< replaceTypeWildcards $ ty
410− kind <- kindOf ty1
411− checkTypeKind ty1 kind
412 unifyTypes val ty1
412 unifyTypes val ty1
413 inferBinder val binder
413 inferBinder val binder
414
414