4 ms·
SPJ, co-author of GHC, added this awesome comment: ""Look at the implementation of other functions in GHC.Prim;they're all defined as let x = x in x." This be
by LukeHoersten 12y ago
SPJ, co-author of GHC, added this awesome comment:
""Look at the implementation of other functions in GHC.Prim;they're all defined as let x = x in x."
This begs the question of why this strange code exists at all. Answer: the sole reason is to give Haddock documentation for the primops a place to live. GHC.Prim is processed by Haddock more or less like any other module; but is effectively ignored by GHC itself.
Worth saying this.
Simon"
- tome 12y agoI never understood why these weren't primop = let x = x in x (+#) = primop or something else at least somewhat meaningful.
- pash 12y agoI don't know the answer to that, but I suspect it might be because there is some reason for the code in GHC.Prim to be monomorphic. There is a Stack Overflow discussion about this that gives a bit more background, by the way. (The answer needlessly digressing into the lambda calculus is mine.) 0. http://stackoverflow.com/questions/15893524/what-is-the-meaning-of-let-x-x-in-x-and-data-float-in-ghc-prim-in-haskell http://stackoverflow.com/questions/15893524/what-is-the-mean...