summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Luposchainsky <dluposchainsky@gmail.com>2017-08-11 11:26:52 +0200
committerBen Gamari <ben@smart-cactus.org>2017-08-17 16:42:55 -0400
commit49ddea9e8014f109df869831b888bcc285600231 (patch)
tree2715e70f9026024956a99bf3b2a84087bcc5527a
parent36d1b08308fdc90e2abaf36cc95ad1a97c0fa8bb (diff)
downloadhaskell-49ddea9e8014f109df869831b888bcc285600231.tar.gz
Sections with undefined operators have non-standard behavior
-rw-r--r--docs/users_guide/bugs.rst23
1 files changed, 23 insertions, 0 deletions
diff --git a/docs/users_guide/bugs.rst b/docs/users_guide/bugs.rst
index 7ccb215d23..f139db1e7a 100644
--- a/docs/users_guide/bugs.rst
+++ b/docs/users_guide/bugs.rst
@@ -348,6 +348,29 @@ The Foreign Function Interface
single: hs_init
single: hs_exit
+.. _infelicities-operator-sections:
+
+Operator sections
+^^^^^^^^^^^^^^^^^
+
+The Haskell Report demands that, for infix operators ``%``, the following
+identities hold:
+
+::
+ (% expr) = \x -> x % expr
+ (expr %) = \x -> expr % x
+
+However, the second law is violated in the presence of undefined operators,
+
+::
+ (%) = error "urk"
+ (() %) `seq` () -- urk
+ (\x -> () % x) `seq` () -- OK, result ()
+
+The operator section is treated like function application of an undefined
+function, while the lambda form is in WHNF that contains an application of an
+undefined function.
+
.. _haskell-98-2010-undefined:
GHC's interpretation of undefined behaviour in HaskellĀ 98 and HaskellĀ 2010