on master help sign in
Fix type constraints for PData

Was generating functions based on free type variables, not on the kind of the constructor.

commitf37e05af5e655e3dcc7b98974623f3ff159f6161 authorEvan Czaplicki <info@elm-lang.org> dateTue 23 Jul 2013, 14:59 (13 years ago) parentd15d84d
1 file changed+2−2
compiler/Type/Constrain/Pattern.hs+2−2
compiler/Type/Constrain/Pattern.hs+2−2
@@ -42,8 +42,8 @@ constrain env pattern tipe =
4242
4343 PData name patterns -> do
4444 (kind, cvars, ctipe) <- freshDataScheme env name
45− tipe' <- foldr (==>) tipe <$> mapM (\_ -> VarN <$> flexibleVar) [1..kind]
46− let tvars = map VarN cvars
45+ tvars <- mapM (\_ -> VarN <$> flexibleVar) [1..kind]
46+ let tipe' = foldr (==>) tipe tvars
4747 msg = concat [ "Constructor '", name, "' expects ", show kind
4848 , " argument", if kind == 1 then "" else "s"
4949 , " but was given ", show (length patterns), "." ]