nicolas
nicolas

Reputation: 9825

What purpose for XNoImplicitPrelude?

Ghci on acid defines in its .gchi

:set -XNoImplicitPrelude

What is the potential benefit/reason one might have for doing so ?

Upvotes: 6

Views: 288

Answers (1)

Daniel Wagner
Daniel Wagner

Reputation: 153182

There is no other way to completely avoid importing the Prelude. Even the seemingly-effective

import Prelude ()

which is an explicit import (hence overrides the implicit one) and defines no names nevertheless puts a bunch of class instances in scope that may not be desired.

Avoiding the standard prelude completely is useful when you want to play around with alternate preludes; or when you want to overload syntax using other GHC extensions; or in other niche situations. Avoiding the prelude can also be useful if you plan on using many functions that happen to be named the same as the ones in the prelude, and would like to avoid qualifying them everywhere (though the lesser import Prelude () would suffice in many such situations).

Upvotes: 13

Related Questions