From 4e574a596ed1b787b252766153bb09785481b2ec Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 28 Aug 2001 15:07:58 +0000 Subject: [PATCH] [project @ 2001-08-28 15:07:58 by simonmar] Correct the USE_REPORT_PRELUDE definition of (!!). --- ghc/lib/std/PrelList.lhs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ghc/lib/std/PrelList.lhs b/ghc/lib/std/PrelList.lhs index 88636bc..63e417d 100644 --- a/ghc/lib/std/PrelList.lhs +++ b/ghc/lib/std/PrelList.lhs @@ -1,5 +1,5 @@ % ------------------------------------------------------------------------------ -% $Id: PrelList.lhs,v 1.25 2001/07/31 10:48:02 simonmar Exp $ +% $Id: PrelList.lhs,v 1.26 2001/08/28 15:07:58 simonmar Exp $ % % (c) The University of Glasgow, 1994-2000 % @@ -447,10 +447,10 @@ concat = foldr (++) [] -- List index (subscript) operator, 0-origin (!!) :: [a] -> Int -> a #ifdef USE_REPORT_PRELUDE -(x:_) !! 0 = x -(_:xs) !! n | n > 0 = xs !! (minusInt n 1) -(_:_) !! _ = error "Prelude.(!!): negative index" -[] !! _ = error "Prelude.(!!): index too large" +xs !! n | n < 0 = error "Prelude.!!: negative index" +[] !! _ = error "Prelude.!!: index too large" +(x:_) !! 0 = x +(_:xs) !! n = xs !! (n-1) #else -- HBC version (stolen), then unboxified -- The semantics is not quite the same for error conditions -- 1.7.10.4