Haskell Primitives
fpcomplete.com
Haskell Primitives
1–10 of 17 posts
Re: Haskell Primitives
#2Re: Haskell Primitives
#3I've been in HFT for a while and what strikes me is the performance optimizations you make in C++, Java, and Haskell are actually so so similar. Get down to the primitives. Avoid boxing. Avoid memory allocation at run time. Makes me think any language can be performant if you know what you're doing.
Re: Haskell Primitives
#4Re: Haskell Primitives
#5""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"
Re: Haskell Primitives
#6Why this intentional misleading title?
Re: Haskell Primitives
#7Re: Haskell Primitives
#8SPJ, 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…
primop = let x = x in x
(+#) = primop
or something else at least somewhat meaningful.Re: Haskell Primitives
#9SPJ, 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…
I never understood why these weren't primop = let x = x in x (+#) = primop or something else at least somewhat meaningful.
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-mean...
Re: Haskell Primitives
#10This is one of my favorite innards-of-Haskell articles. It's such an intuitive way to look at how a super high level language like Haskell gets down to machine primitives. So important for optimization too. I've been in HFT for a while and what strikes me is the performance optimizations you make in C++, Java, and Haskell are actually so so similar. Get down to the primitives. Avoid boxing. Avoid memory allocation at…