News for hackers. Stuff that matters.
Re:Haskell for a New Decade [pdf] by chrisseaton on Tuesday June 23, 2020 @07:38PM (#23621865)
> Stream API would be my first thought but I am not as familiar with Java.

Can you name any design characteristics in Java's stream API that came from Haskell, rather than were already common in many languages when Haskell itself was designed? I can't.

Re:Haskell for a New Decade [pdf] by atombender on Wednesday June 24, 2020 @01:23AM (#23624392)
Java's "stream fusion" is inspired by the same technique that was originally implemented, I believe, in Haskell [1].

[1] http://fun.cs.tufts.edu/stream-fusion.pdf

Re:Haskell for a New Decade [pdf] by chrisseaton on Wednesday June 24, 2020 @06:45AM (#23626402)
But Java doesn't do stream fusion as you're describing.

It does conventional inlining and combining loop bodies, which can in some trivial cases achieve the same effect, but these are techniques you'd find in any compiler or even an 80s text book - they didn't come from Haskell.

Here's the limitation of Java's 'fusion' - you'll notice there's no pass to do this in Hotspot - it just happens due to the inlining and GCM passes.

https://github.com/openjdk/jdk/blob/883a4f65b9b1533c8a51d156...

And here's a paper on trying to add actual Fusion to Java, which they wouldn't be doing if Java had it already.

https://dl.acm.org/doi/pdf/10.1145/3355378.3355386?download=...