summaryrefslogtreecommitdiff
path: root/libraries/base/Data
diff options
context:
space:
mode:
authorOleg Grenrus <oleg.grenrus@iki.fi>2022-12-10 18:10:44 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-01-09 21:11:02 -0500
commitd53f6f4d98aabd6f5b28fb110db1da0f6db70a06 (patch)
tree371730f12e7f76d3ea594423b46a050481556d8d /libraries/base/Data
parente3fff7512bbf989386faaa1dccafdad1deabde84 (diff)
downloadhaskell-d53f6f4d98aabd6f5b28fb110db1da0f6db70a06.tar.gz
Add safe list indexing operator: !?
With Joachim's amendments. Implements https://github.com/haskell/core-libraries-committee/issues/110
Diffstat (limited to 'libraries/base/Data')
-rw-r--r--libraries/base/Data/List.hs1
-rw-r--r--libraries/base/Data/OldList.hs1
2 files changed, 2 insertions, 0 deletions
diff --git a/libraries/base/Data/List.hs b/libraries/base/Data/List.hs
index d7a5922031..a81c743357 100644
--- a/libraries/base/Data/List.hs
+++ b/libraries/base/Data/List.hs
@@ -127,6 +127,7 @@ module Data.List
-- | These functions treat a list @xs@ as a indexed collection,
-- with indices ranging from 0 to @'length' xs - 1@.
+ , (!?)
, (!!)
, elemIndex
diff --git a/libraries/base/Data/OldList.hs b/libraries/base/Data/OldList.hs
index 176c72547c..8e610ebba0 100644
--- a/libraries/base/Data/OldList.hs
+++ b/libraries/base/Data/OldList.hs
@@ -127,6 +127,7 @@ module Data.OldList
-- | These functions treat a list @xs@ as a indexed collection,
-- with indices ranging from 0 to @'length' xs - 1@.
+ , (!?)
, (!!)
, elemIndex