Disabling the prelude

  • In Haskell source files
  • In GHCi
  • Using module mixins

There are some reasons you might not want the entire contents of the prelude to be implicitly present everywhere:

  • If you are a learner and you want to reimplement parts of base for exercise, and you need to avoid creating name clashes with the things that are already defined in Prelude.
  • If you are an opinionated expert and you dislike many of the things in Prelude.
  • If you are using the RebindableSyntax extension, which automatically disables the implicit prelude.

In this article, we show you several ways to remove the prelude from scope:

  • With the NoImplicitPrelude extension.
  • By importing Prelude with an empty import list.
  • By using module mixins.

Sign up for access to the full page, plus the complete archive and all the latest content.