-------------------------------------------
-- Arrow application
--- (f -< a) or (f =< a)
+-- (f -< a) or (f -<< a)
tc_cmd env cmd@(HsArrApp fun arg _ ho_app lr) (cmd_stk, res_ty)
= addErrCtxt (cmdCtxt cmd) $
do { arg_ty <- newTyVarTy openTypeKind
- ; let fun_ty = mkCmdArrTy env arg_ty res_ty
-
- ; checkTc (null cmd_stk) (nonEmptyCmdStkErr cmd)
+ ; let fun_ty = mkCmdArrTy env (foldl mkPairTy arg_ty cmd_stk) res_ty
; fun' <- pop_arrow_binders (tcCheckRho fun fun_ty)
-- Before type-checking f, remove the "arrow binders" from the
-- environment in the (-<) case.
-- Local bindings, inside the enclosing proc, are not in scope
- -- inside f. In the higher-order case (--<), they are.
+ -- inside f. In the higher-order case (-<<), they are.
pop_arrow_binders tc = case ho_app of
HsHigherOrderApp -> tc
HsFirstOrderApp -> popArrowBinders tc
tc_cmd env cmd@(HsArrForm expr fixity cmd_args) (cmd_stk, res_ty)
= addErrCtxt (cmdCtxt cmd) $
- do { cmds_w_tys <- mapM new_cmd_ty (cmd_args `zip` [1..])
+ do { cmds_w_tys <- zipWithM new_cmd_ty cmd_args [1..]
; w_tv <- newSigTyVar liftedTypeKind
; let w_ty = mkTyVarTy w_tv
where
-- Make the types
-- b, ((e,s1) .. sm), s
- new_cmd_ty :: (LHsCmdTop Name, Int)
+ new_cmd_ty :: LHsCmdTop Name -> Int
-> TcM (LHsCmdTop Name, Int, TcType, TcType, TcType)
- new_cmd_ty (cmd,i)
+ new_cmd_ty cmd i
= do { b_ty <- newTyVarTy arrowTyConKind
; tup_ty <- newTyVarTy liftedTypeKind
-- We actually make a type variable for the tuple