Giter VIP home page Giter VIP logo

Comments (4)

quchen avatar quchen commented on September 28, 2024

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 -> ⊥, since seq 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.

haasn avatar haasn commented on September 28, 2024

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.

quchen avatar quchen commented on September 28, 2024

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.

quchen avatar quchen commented on September 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.