Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What purpose for XNoImplicitPrelude?

Tags:

haskell

ghci

Ghci on acid defines in its .gchi

:set -XNoImplicitPrelude

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

like image 544
nicolas Avatar asked Dec 06 '14 10:12

nicolas


1 Answers

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).

like image 95
Daniel Wagner Avatar answered Oct 17 '22 21:10

Daniel Wagner