on master help sign in
Add flexible variables for type annotated values

Without this, things are not generalized properly.

commitd9471f6c62611ef2db72b1eb48a7627c3a8ec5a2 authorEvan Czaplicki <info@elm-lang.org> dateMon 22 Jul 2013, 14:41 (13 years ago) parent6f94400
1 file changed+2−2
compiler/Type/Constrain/Expression.hs+2−2
compiler/Type/Constrain/Expression.hs+2−2
@@ -189,9 +189,9 @@ constrainDef env info (pattern, expr, maybeTipe) =
189189 do flexiVars <- mapM (\_ -> flexibleVar) qs
190190 let inserts = zipWith (\arg typ -> Map.insert arg (VarN typ)) qs flexiVars
191191 env' = env { Env.value = List.foldl' (\x f -> f x) (Env.value env) inserts }
192− typ <- Env.instantiateType env tipe
192+ (vars, typ) <- Env.instantiateTypeWithContext env tipe Map.empty
193193 let scheme = Scheme { rigidQuantifiers = [],
194− flexibleQuantifiers = flexiVars,
194+ flexibleQuantifiers = flexiVars ++ vars,
195195 constraint = CTrue,
196196 header = Map.singleton name typ }
197197 c <- constrain env' expr typ