projects
/
ghc-base.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add tests from testsuite/tests/h98
[ghc-base.git]
/
GHC
/
List.lhs
diff --git
a/GHC/List.lhs
b/GHC/List.lhs
index
67c651e
..
ff8593c
100644
(file)
--- a/
GHC/List.lhs
+++ b/
GHC/List.lhs
@@
-1,6
+1,7
@@
\begin{code}
\begin{code}
-{-# OPTIONS_GHC -XNoImplicitPrelude #-}
+{-# LANGUAGE CPP, NoImplicitPrelude, MagicHash #-}
{-# OPTIONS_HADDOCK hide #-}
{-# OPTIONS_HADDOCK hide #-}
+
-----------------------------------------------------------------------------
-- |
-- Module : GHC.List
-----------------------------------------------------------------------------
-- |
-- Module : GHC.List
@@
-503,11
+504,15
@@
or (x:xs) = x || or xs
#endif
-- | Applied to a predicate and a list, 'any' determines if any element
#endif
-- | Applied to a predicate and a list, 'any' determines if any element
--- of the list satisfies the predicate.
+-- of the list satisfies the predicate. For the result to be
+-- 'False', the list must be finite; 'True', however, results from a 'True'
+-- value for the predicate applied to an element at a finite index of a finite or infinite list.
any :: (a -> Bool) -> [a] -> Bool
-- | Applied to a predicate and a list, 'all' determines if all elements
any :: (a -> Bool) -> [a] -> Bool
-- | Applied to a predicate and a list, 'all' determines if all elements
--- of the list satisfy the predicate.
+-- of the list satisfy the predicate. For the result to be
+-- 'True', the list must be finite; 'False', however, results from a 'False'
+-- value for the predicate applied to an element at a finite index of a finite or infinite list.
all :: (a -> Bool) -> [a] -> Bool
#ifdef USE_REPORT_PRELUDE
any p = or . map p
all :: (a -> Bool) -> [a] -> Bool
#ifdef USE_REPORT_PRELUDE
any p = or . map p
@@
-527,7
+532,8
@@
all p (x:xs) = p x && all p xs
#endif
-- | 'elem' is the list membership predicate, usually written in infix form,
#endif
-- | 'elem' is the list membership predicate, usually written in infix form,
--- e.g., @x \`elem\` xs@.
+-- e.g., @x \`elem\` xs@. For the result to be
+-- 'False', the list must be finite; 'True', however, results from an element equal to @x@ found at a finite index of a finite or infinite list.
elem :: (Eq a) => a -> [a] -> Bool
-- | 'notElem' is the negation of 'elem'.
elem :: (Eq a) => a -> [a] -> Bool
-- | 'notElem' is the negation of 'elem'.