Go to the first, previous, next, last section, table of contents.
Probably only of interest to implementors...
The prelude libraries are organised into the following three groups,
each of which is kept in a separate sub-directory of GHC's source
`lib/' directory:
- `lib/required/'
- These are the libraries required by the
Haskell definition. All are defined by the Haskell Report, or by the
Haskell Libraries Report.
They currently comprise:
-
- `Array': monolithic arrays.
-
- `Char': more functions on characters.
-
- `Complex': interface defining complex number type and functions
over it.
-
- `CPUTime': get the CPU time used by the program.
-
- `Directory': basic functions for accessing the file system.
-
- `Ix': the `Ix' class of indexing operations.
-
- `IO': additional input/output functions.
-
- `List': more functions on lists.
-
- `Locale': localisation functions.
-
- `Maybe': more functions on `Maybe' types.
-
- `Monad': functions on monads.
-
- `Numeric': operations for reading and showing number values.
-
- `Prelude': standard prelude interface.
-
- `Random': pseudo-random number generator.
-
- `Ratio': functions on rational numbers.
-
- `System': basic operating-system interface functions.
-
- `Time': operations on time.
- `lib/glaExts'
- Extension libraries, currently comprising:
-
- `Addr': primitive pointer type.
-
- `Bits': a class of bitwise operations.
-
- `ByteArray': operations over immutable chunks of (heap allocated) bytes.
-
- `CCall': classes `CCallable' and `CReturnable' for calling C.
-
- `Foreign': types and operations for GHC's foreign-language
interface.
-
- `GlaExts': interface for extensions that are only implemented in
GHC: namely unboxed types and primitive operations.
-
- `IOExts': extensions to the `IO' library.
-
- `Int': 8, 16, 32 and 64-bit integers with bit operations.
-
- `LazyST': a lazy version of the `ST' monad.
-
- `MutableArray': operations over mutable arrays.
-
- `ST': the state transformer monad, `STRef's and `STArray's.
-
- `Word': 8, 16, 32 and 64-bit naturals with bit operations.
- `lib/concurrent'
- GHC extension libraries to support Concurrent Haskell, currently comprising:
-
- `Concurrent': main library.
-
- `Parallel': stuff for multi-processor parallelism.
-
- `Channel'
-
- `ChannelVar'
-
- `Merge'
-
- `SampleVar'
-
- `Semaphore'
- `lib/ghc'
- These libraries are the pieces on which all the
others are built. They aren't typically imported by Joe Programmer,
but there's nothing to stop you doing so if you want. In general, the
modules prefixed by `Prel' are pieces that go towards building
`Prelude'.
-
- `GHC': this "library" brings into scope all the primitive
types and operations, such as `Int#', `+#', `encodeFloat#', etc etc.
It is unique in that there is no Haskell source code for it. Details
in Section See section The module `GHC': really primitive stuff.
-
- `PrelBase': defines the basic types and classes without which
very few Haskell programs can work. The classes are: `Eq', `Ord',
`Enum', `Bounded', `Num', `Show', `Eval', `Monad', `MonadZero',
`MonadPlus'. The types are: list, `Bool', `Char', `Ordering',
`String', `Int', `Integer'.
-
- `PrelMaybe': defines the `Maybe' type.
-
- `PrelEither': defines the `Either' type.
-
- `PrelTup': defines tuples and their instances.
-
- `PrelList': defines most of the list operations required by
`Prelude'. (A few are in `PrelBase', to avoid gratuitous mutual
recursion between modules.)
-
- `PrelNum' defines: the numeric classes beyond `Num', namely
`Real', `Integral', `Fractional', `Floating', `RealFrac', `RealFloat';
instances for appropriate classes for `Int' and `Integer'; the types
`Float', `Double', and `Ratio' and their instances.
-
- `PrelRead': the `Read' class and all its instances. It's kept
separate because many programs don't use `Read' at all, so we don't
even want to link in its code. (If the prelude libraries are built by
splitting the object files, this is all a non-issue)
-
- `ConcBase': substrate stuff for Concurrent Haskell.
-
- `IOBase': substrate stuff for the main I/O libraries.
-
- `IOHandle': large blob of code for doing I/O on handles.
-
- `PrelIO': the remaining small pieces to produce the I/O stuff
needed by `Prelude'.
-
- `STBase': substrate stuff for `ST'.
-
- `ArrBase': substrate stuff for `Array'.
-
- `GHCerr': error reporting code, called from code that the
compiler plants in compiled programs.
-
- `GHCmain': the definition of `mainIO', which is what really gets called by the runtime system. `mainIO' in turn
calls `main'.
-
- `PackBase': low-level packing/unpacking operations.
-
- `Error': the definition of `error', placed in its own module
with a hand-written `.hi-boot' file in order to break recursive
dependencies in the libraries (everything needs `error', but the
definition of `error' itself needs a few things...).
The `...Base' modules generally export representation information that
is hidden from the public interface. For example the module `STBase'
exports the type `ST' including its representation, whereas the module
`ST' exports `ST' abstractly.
None of these modules are involved in any mutual recursion, with the
sole exception that many modules import `Error.error'.
Go to the first, previous, next, last section, table of contents.