3 ms·
Why are the stream fusion functions in a separate module? Why were the functions in prelude not replaced by these more efficient ones?
by wereHamster 13y ago
Why are the stream fusion functions in a separate module? Why were the functions in prelude not replaced by these more efficient ones?
- PhineasRex 13y agoPartly for historical reasons and partly because Prelude is really intended for beginners.
- tel 13y agoAlso for definitional reasons!
- DanWaterworth 13y agoCould you elaborate?
- cantankerous 13y agoHe means that there is a generally understood semantic meaning for the functions as they exist in the Haskell Prelude. Replacing them under the hood with something potentially different makes the "meaning" of the basic functions not quite the same. Haskell has a history rooted in this kind of thing so it continues in the community now.
- tel 13y agoYup! Thanks
- wereHamster 13y agoBut they are not different. The functions in stream-fusion are a drop-in replacement for the ones in Data.List. To quote the package description: "To use, simply import Data.List.Stream in place of Data.List, and hide list functions from the Prelude." So to put simply: you have two functions. They are semantically equivalent, but one is faster than the other. Why not use the faster one?