[commit: ghc] master: Sections with undefined operators have non-standard behavior (49ddea9)

git at git.haskell.org git at git.haskell.org
Thu Aug 17 20:43:33 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/49ddea9e8014f109df869831b888bcc285600231/ghc

>---------------------------------------------------------------

commit 49ddea9e8014f109df869831b888bcc285600231
Author: David Luposchainsky <dluposchainsky at gmail.com>
Date:   Fri Aug 11 11:26:52 2017 +0200

    Sections with undefined operators have non-standard behavior


>---------------------------------------------------------------

49ddea9e8014f109df869831b888bcc285600231
 docs/users_guide/bugs.rst | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/docs/users_guide/bugs.rst b/docs/users_guide/bugs.rst
index 7ccb215..f139db1 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



More information about the ghc-commits mailing list