@@ -179,7 +179,7 @@ overTypes f = let (_, f', _) = everywhereOnValues id g id in f'
179 g (TypedValue checkTy val t) = TypedValue checkTy val (f t)
179 g (TypedValue checkTy val t) = TypedValue checkTy val (f t)
180 g (TypeClassDictionary (nm, tys) sco) = TypeClassDictionary (nm, map f tys) sco
180 g (TypeClassDictionary (nm, tys) sco) = TypeClassDictionary (nm, map f tys) sco
181 g other = other
181 g other = other
183-- | Check the kind of a type, failing if it is not of kind *.
183-- | Check the kind of a type, failing if it is not of kind *.
184checkTypeKind ::
184checkTypeKind ::
185 (MonadState CheckState m, MonadError MultipleErrors m) =>
185 (MonadState CheckState m, MonadError MultipleErrors m) =>
@@ -283,8 +283,10 @@ infer' (IfThenElse cond th el) = do
283 cond' <- check cond tyBoolean
283 cond' <- check cond tyBoolean
284 th'@(TypedValue _ _ thTy) <- infer th
284 th'@(TypedValue _ _ thTy) <- infer th
285 el'@(TypedValue _ _ elTy) <- infer el
285 el'@(TypedValue _ _ elTy) <- infer el
286+ (th'', thTy') <- instantiatePolyTypeWithUnknowns th' thTy
287+ (el'', elTy') <- instantiatePolyTypeWithUnknowns el' elTy
286− unifyTypes thTy elTy
288+ unifyTypes thTy' elTy'
287− return $ TypedValue True (IfThenElse cond' th' el') thTy
289+ return $ TypedValue True (IfThenElse cond' th'' el'') thTy'
288infer' (Let ds val) = do
290infer' (Let ds val) = do
289 (ds', val'@(TypedValue _ _ valTy)) <- inferLetBinding [] ds val infer
291 (ds', val'@(TypedValue _ _ valTy)) <- inferLetBinding [] ds val infer
290 return $ TypedValue True (Let ds' val') valTy
292 return $ TypedValue True (Let ds' val') valTy