Comments (4)
I don't think GHC is at fault here, the Haskell report simply seems to be inconsistent. The section about strict evaluation says
As a consequence,
⊥
is not the same as\x -> ⊥
, sinceseq
can be used to distinguish them.
Since the section section claims that (e op) = \x -> e op x
unconditionally, we have a contradiction.
from articles.
I don't think this is a contradiction. (e op)
is a special syntax form that doesn't even “exist” before it's defined, as \x -> e op x
by the ‘section’ section.
Furthermore, all that this definition + the other line you quoted together imply is that (e ⊥) = \x -> ⊥ e x
is not ⊥
- which is perfectly consistent (with the theory, but not the GHC implementation).
Interestingly, it seems that we've had a number of conversations about this topic before, eg.
2014-02-11 21:58:16 haasn quchen: https://github.com/quchen/articles/blob/master/fbut.md#a-op-is-not-x---a-op-x is this a bug?
2014-02-11 21:58:29 haasn the haskell report clearly specifies (e op) = \ x -> e op x
2014-02-11 22:01:44 thoughtpolice haasn: http://www.haskell.org/onlinereport/haskell2010/haskellch6.html#x13-1260006.2
2014-02-11 22:01:52 thoughtpolice "As a consequence, ⊥ is not the same as \x -> ⊥, since seq can be used to distinguish them. For the same reason, the existence of seq weakens Haskell’s parametricity properties."
2014-02-11 22:02:25 shachaf thoughtpolice: Yes, I think haasn is aware.
2014-02-11 22:02:40 shachaf Hence the issue with (x `op`) being _|_
2014-02-11 22:03:11 shachaf I think this issue is not quite important enough to care about making GHC compliant.
2014-02-11 22:03:19 shachaf I would probably rather have PostfixOperators go into the Report.
2014-02-11 22:03:46 thoughtpolice oh, i misread. the *sections* are the complaint. i take back my annoying quote of the report
2013-07-02 15:53:01 haasn these are just simple translation rules; (a ==) literally parses as (==) a; and (== a) literally parses as \x -> (==) x a
2013-07-02 15:54:16 shachaf haasn: No, it doesn't parse as that, and it also doesn't mean that (in standard Haskell, anyway).
...
2013-07-02 15:56:15 haasn Translation: The following identities hold:
2013-07-02 15:56:15 haasn (op e) = \ x -> x op e
2013-07-02 15:56:15 haasn (e op) = \ x -> e op x
2013-07-02 15:56:30 haasn looks like my (a ==) case was incorrect
2013-07-02 15:56:39 elliott I assume shachaf is referring to the fact that ((==) a) isn't quite the same as (\b -> a == b)
2013-07-02 15:56:49 shachaf Yes, what elliott said.
2013-07-02 15:56:56 elliott though frankly I think we'd all like to forget that that isn't true, and I believe we usually act as such
...
2013-07-02 15:57:25 quchen elliott: Pedantry or not, what's the difference between the two?
2013-07-02 15:58:03 elliott quchen: _|_
2013-07-02 15:58:13 elliott > (undefined :: () -> ()) `seq` ()
2013-07-02 15:58:14 lambdabot *Exception: Prelude.undefined
2013-07-02 15:58:23 haasn > let (==) = undefined in seq (\x -> () == x) ()
2013-07-02 15:58:24 lambdabot ()
2013-07-02 15:59:23 quchen elliott: Ah, the ability of seq to distinguish between bottom and (const bottom)
(Maybe you missed the first part of this conversation, way back when?)
from articles.
Hm. In that case we should make sure the issue is really the one we think it is, and add a remark about it in the article.
from articles.
I added a paragraph to the section in question, mentioning GHC's non-compliant behaviour with the link you provided.
(Thanks for telling me about this, I had no idea.)
from articles.
Related Issues (20)
- reference to Data.Text.readMaybe, which does not exist
- Questionable claim in MFP2 HOT 4
- Innacuracy due to GHC 7.10 in Monad hierachy. HOT 1
- maybeLoeb HOT 2
- 'Write yourself a Brainfuck in an hour' section 2, exercise 3 confusing wording HOT 1
- `The second Functor law is redundant` is not proper HOT 3
- Remove warning from the second functor law article HOT 1
- Hindley-Milner Inference Oddity w/ Twice Combinator HOT 3
- fbut: (\p1 p2 -> e) is not (\p1 -> \p2 -> e) HOT 3
- Invalid proof? HOT 3
- loeb moeb swing HOT 2
- Small slip with $ HOT 4
- Inferred (rank 1) type of moeb could be more general HOT 1
- (a `op`) is \x -> a `op` x HOT 2
- State where not-bottom assumption was used HOT 3
- loeb: how to detect non-termination? HOT 1
- zipWith question: drop in splitMiddle HOT 1
- zipWith question: flip in rotateUntil HOT 1
- zipWith question: Correctness of optimized Polygon Eq HOT 1
- Another approach to fix HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from articles.