Arjun Guha
Arjun Guha

Reputation: 496

custom Prelude module -- bad idea?

I just realized that I can define my own Prelude module and carefully control its exports. Is this considered bad practice?

Advantages:

Upvotes: 8

Views: 530

Answers (1)

Don Stewart
Don Stewart

Reputation: 137997

In general its a bad idea, as you end up with code written in your own idioms that isn't going to be easy to maintain by others.

To communicate with others you need a shared language of symbols. The Prelude is our core language, so if you redefine it, expect confusion.

The exception to this rule would be when developing an embedded domain-specific language. There, making a custom Prelude is entirely a good idea, and is indeed why it is possible to redefine the Prelude (and inbuilt syntax) in the first place.

By all means have your own additional modules, but don't override the Prelude.

Upvotes: 9

Related Questions