Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
jberryman
GHC
Commits
4e574a59
Commit
4e574a59
authored
Aug 28, 2001
by
simonmar
Browse files
[project @ 2001-08-28 15:07:58 by simonmar]
Correct the USE_REPORT_PRELUDE definition of (!!).
parent
b0604aad
Changes
1
Hide whitespace changes
Inline
Side-by-side
ghc/lib/std/PrelList.lhs
View file @
4e574a59
% ------------------------------------------------------------------------------
% $Id: PrelList.lhs,v 1.2
5
2001/0
7/31 10:48:02
simonmar Exp $
% $Id: PrelList.lhs,v 1.2
6
2001/0
8/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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment