Hacker News new | ask | show | jobs
by nilkn 3388 days ago
Any recommendations on which new prelude to use? I'm fairly competent with Haskell but have never looked into these and am feeling decision paralysis -- too many choices.
3 comments

I've tried a bunch of alternative prelude and my experience is that it makes it very hard to integrate with code that uses the standard prelude. Foundation seems to have the highest chances of success right now, ClassyPrelude seems to be the most well-used, and Protolude seems to be more like a framework to build your own prelude.
I've never understood the hard-to-integrate argument; I can still do `import qualified Prelude as P`.
Right, but you need to do explicit conversions between `Foundation.String` and `Prelude.String` at your app's boundaries (for example.)
If you're competent with Haskell, don't bother. A new Prelude will save you a bunch of imports; that's it. If you're fretting over which one to use, you've already spent too much time making this decision; just stick with the regular Prelude and use your imports.

The worst thing about the default Prelude is that it encourages bad behavior among new users--for instance, with partial functions like `head`. Experienced people know what to avoid and what to work around. So if picking an alternative Prelude seems like too much work, it is.

I have a project where I have mostly dumped the Prelude. All it is doing is saving me a bunch of imports. That's nice but not earth-shaking.

We're mostly using Protolude at the moment. It has some nice properties, e.g.

* "id" renamed to "identity" so you can use id in your own code

* panic functions like "notImplemented"

* a generic string converter "toS"

* lots more

But to be fair most modern preludes work OK.

Foundation is a bit different in that it doesn't ship a huge amount yet but has the potential to eventually replace the core prelude with saner default types like utf8-encoded strings. If you need to ship to production yesterday I would not use Foundation just yet.