@@ -179,7 +179,7 @@ overTypes f = let (_, f', _) = everywhereOnValues id g id in f'
179179 g (TypedValue checkTy val t) = TypedValue checkTy val (f t)
180180 g (TypeClassDictionary (nm, tys) sco) = TypeClassDictionary (nm, map f tys) sco
181181 g other = other
182−
182+
183183-- | Check the kind of a type, failing if it is not of kind *.
184184checkTypeKind ::
185185 (MonadState CheckState m, MonadError MultipleErrors m) =>
@@ -283,8 +283,10 @@ infer' (IfThenElse cond th el) = do
283283 cond' <- check cond tyBoolean
284284 th'@(TypedValue _ _ thTy) <- infer th
285285 el'@(TypedValue _ _ elTy) <- infer el
286− unifyTypes thTy elTy
287− return $ TypedValue True (IfThenElse cond' th' el') thTy
286+ (th'', thTy') <- instantiatePolyTypeWithUnknowns th' thTy
287+ (el'', elTy') <- instantiatePolyTypeWithUnknowns el' elTy
288+ unifyTypes thTy' elTy'
289+ return $ TypedValue True (IfThenElse cond' th'' el'') thTy'
288290infer' (Let ds val) = do
289291 (ds', val'@(TypedValue _ _ valTy)) <- inferLetBinding [] ds val infer
290292 return $ TypedValue True (Let ds' val') valTy