summaryrefslogtreecommitdiff
path: root/libraries/base/Prelude.hs
diff options
context:
space:
mode:
authorMichael Snoyman <michael@snoyman.com>2014-08-10 15:54:01 -0500
committerAustin Seipp <austin@well-typed.com>2014-08-10 15:54:02 -0500
commitcbfa107604f4cbfaf02bd633c1faa6ecb90c6dd7 (patch)
tree2b876bbb54e61cd3d684936f3f76a1e4c5a92535 /libraries/base/Prelude.hs
parent8d90ffae3a3c0d7c9ac8800ae91887aeaa9917d3 (diff)
downloadhaskell-cbfa107604f4cbfaf02bd633c1faa6ecb90c6dd7.tar.gz
Improve seq documentation; part of trac issue #9390
Summary: Signed-off-by: Michael Snoyman <michael@snoyman.com> Test Plan: Review documentation change Reviewers: simonpj, austin Reviewed By: austin Subscribers: phaskell, hvr, simonmar, relrod, ezyang, carter Differential Revision: https://phabricator.haskell.org/D136 GHC Trac Issues: #9390
Diffstat (limited to 'libraries/base/Prelude.hs')
-rw-r--r--libraries/base/Prelude.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/libraries/base/Prelude.hs b/libraries/base/Prelude.hs
index 6be784603c..9b1119e155 100644
--- a/libraries/base/Prelude.hs
+++ b/libraries/base/Prelude.hs
@@ -163,6 +163,13 @@ f $! x = let !vx = x in f vx -- see #2273
-- | The value of @'seq' a b@ is bottom if @a@ is bottom, and otherwise
-- equal to @b@. 'seq' is usually introduced to improve performance by
-- avoiding unneeded laziness.
+--
+-- A note on evaluation order: the expression @seq a b@ does /not/ guarantee
+-- that @a@ will be evaluated before @b@. The only guarantee given by @seq@ is
+-- that the both @a@ and @b@ will be evaluated before @seq@ returns a value. In
+-- particular, this means that @b@ may be evaluated before @a@. If you need to
+-- guarantee a specific order of evaluation, you must use the function @pseq@
+-- from the parallel package.
seq :: a -> b -> b
seq _ y = y
#endif