Personal tools

Prelude

From HaskellWiki

Revision as of 22:29, 10 January 2008 by MichalPalka (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Prelude is a module that contains a small set of standard definitions and is included automatically into all Haskell modules.

Contents

1 Documentation

The documentation of prelude from GHC can be found here.

2 Avoiding prelude

If you wish to program without a prelude or to use a custom version of it you can suppress its automatic inclusion in several ways.

2.1 Explicit import decalration

By including an explicit import declaration of prelude as follows

import Prelude ()

The empty import list in the parenthesis causes nothing to be imported while the automatic import is prevented as well.

2.2 Language option

GHC supports a language option -XNoImplicitPrelude (or -fno-implicit-prelude in older GHC) that makes it not import prelude implicitly. The option can be also specified by adding:

{-# LANGUAGE NoImplicitPrelude #-}

on top of the module.

This option makes it possible to rebind the monadic
do
syntax.