diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2013-01-02 16:38:46 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2013-01-02 16:38:46 +0000 |
commit | b0c0cae7e1ed65ac8dd218a9018f82a4ceac6842 (patch) | |
tree | 784b8e1c9f6d14b43593299ebe750fdb31d2aef8 /compiler/deSugar/DsListComp.lhs | |
parent | 545fd8b9217e0230b90da211f9672dc3c2ead2d1 (diff) | |
download | haskell-b0c0cae7e1ed65ac8dd218a9018f82a4ceac6842.tar.gz |
Define ListSetOps.getNth, and use it
I was tracking down an error looking like
Prelude.(!!): index too large
which is very unhelpful. This patch replaces at least some uses
of (!!) in GHC with getNth, which has a more helpful error
message (with DEBUG anyway)
Diffstat (limited to 'compiler/deSugar/DsListComp.lhs')
-rw-r--r-- | compiler/deSugar/DsListComp.lhs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/deSugar/DsListComp.lhs b/compiler/deSugar/DsListComp.lhs index 1b81e1a248..55cd837f78 100644 --- a/compiler/deSugar/DsListComp.lhs +++ b/compiler/deSugar/DsListComp.lhs @@ -33,6 +33,7 @@ import SrcLoc import Outputable import FastString import TcType +import ListSetOps( getNth ) import Util \end{code} @@ -869,11 +870,11 @@ mkMcUnzipM _ fmap_op ys elt_tys ; tup_xs <- newSysLocalDs tup_ty ; let mk_elt i = mkApps fmap_op' -- fmap :: forall a b. (a -> b) -> n a -> n b - [ Type tup_ty, Type (elt_tys !! i) + [ Type tup_ty, Type (getNth elt_tys i) , mk_sel i, Var ys] mk_sel n = Lam tup_xs $ - mkTupleSelector xs (xs !! n) tup_xs (Var tup_xs) + mkTupleSelector xs (getNth xs n) tup_xs (Var tup_xs) ; return (mkBigCoreTup (map mk_elt [0..length elt_tys - 1])) } \end{code} |