Hacker News new | ask | show | jobs
by coolsunglasses 4537 days ago
>That's functional programming for you.

Uhm, what? No it's not.

Haskell has stream fusion, thereby generating assembler that looks a lot like the optimal imperative version.

2 comments

This is kind of misleading. Stream fusion isn't baked into Haskell; you need to use a library. [1,2]

    [1] - https://ghc.haskell.org/trac/ghc/ticket/915
    [2] - http://hackage.haskell.org/package/stream-fusion
http://hackage.haskell.org/package/text-0.1/docs/Data-Text-F...

http://hackage.haskell.org/package/vector-0.9.1/docs/Data-Ve...

Except it's bloody everywhere in the libraries you use and you can design your own libraries around it.

A language powerful enough that things like this can be done in libraries instead of in the compiler is a good thing.

But, many of the commonly used libraries already use stream fusion, e.g. vector and text.
Very cool - I was not aware of this feature. Fwiw, I'm actually something of an FP zealot; I failed to make a stronger case in my comment because I'm tired of arguing, and I'm concerned that I'm being obnoxious.