From 6ee15d3170297b3f7e4f5aaeba90d7fd0e19367c Mon Sep 17 00:00:00 2001 From: Ross Paterson Date: Sun, 22 Aug 2010 09:00:22 +0000 Subject: [PATCH] fix extraction of command stack of arguments of arrow "forms" (fixes #4236) The command stack was being extracted (by unscramble) with the outermost type first, contrary to the comment on the function. --- compiler/typecheck/TcArrows.lhs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/compiler/typecheck/TcArrows.lhs b/compiler/typecheck/TcArrows.lhs index 9fede38..231901c 100644 --- a/compiler/typecheck/TcArrows.lhs +++ b/compiler/typecheck/TcArrows.lhs @@ -294,14 +294,13 @@ tc_cmd env cmd@(HsArrForm expr fixity cmd_args) (cmd_stk, res_ty) unscramble :: TcType -> (TcType, [TcType]) -- unscramble ((w,s1) .. sn) = (w, [s1..sn]) - unscramble ty + unscramble ty = unscramble' ty [] + + unscramble' ty ss = case tcSplitTyConApp_maybe ty of Just (tc, [t,s]) | tc == pairTyCon - -> let - (w,ss) = unscramble t - in (w, s:ss) - - _ -> (ty, []) + -> unscramble' t (s:ss) + _ -> (ty, ss) ----------------------------------------------------------------- -- Base case for illegal commands -- 1.7.10.4