diff options
author | simonpj <unknown> | 1999-12-20 10:34:37 +0000 |
---|---|---|
committer | simonpj <unknown> | 1999-12-20 10:34:37 +0000 |
commit | e921b2e307532e0f30eefa88b11a124be592bde4 (patch) | |
tree | 4512ea94bc7aff13ccbd13f513ee40bf5beedf88 /ghc/docs | |
parent | f7989a6dea8c43352f363117d9bb07439953ccdc (diff) | |
download | haskell-e921b2e307532e0f30eefa88b11a124be592bde4.tar.gz |
[project @ 1999-12-20 10:34:27 by simonpj]
This commit implements a substantial re-organisation of the Prelude
It also fixes a couple of small renamer bugs that were reported recently
(notably, Sven pointed out that we weren't reporting
unused imports properly)
My original goal was to get rid of all "orphan" modules (i.e. ones
with instance decls that don't belong either to a tycon or a class
defined in the same module). This should reduce the number of
interface files that have to be read when compiling small Haskell
modules.
But like most expeditions into the Prelude Swamp, it spiraled out
of control. The result is quite satisfactory, though.
GONE AWAY: PrelCCall, PrelNumExtra
NEW: PrelReal, PrelFloat, PrelByteArr, PrelNum.hi-boot
(The extra PrelNum.hi-boot is because of a tiresome thin-air Id, addr2Integer,
which used to be in PrelBase.)
Quite a lot of types have moved from one module to another,
which entails some changes to part of the compiler (PrelInfo, PrelMods) etc,
and there are a few places in the RTS includes and even in the driver
that know about these home modules (alas).
So the rough structure is as follows, in (linearised) dependency order
[this list now appears in PrelBase.lhs]
PrelGHC Has no implementation. It defines built-in things, and
by importing it you bring them into scope.
The source file is PrelGHC.hi-boot, which is just
copied to make PrelGHC.hi
Classes: CCallable, CReturnable
PrelBase Classes: Eq, Ord, Functor, Monad
Types: list, (), Int, Bool, Ordering, Char, String
PrelTup Types: tuples, plus instances for PrelBase classes
PrelShow Class: Show, plus instances for PrelBase/PrelTup types
PrelEnum Class: Enum, plus instances for PrelBase/PrelTup types
PrelMaybe Type: Maybe, plus instances for PrelBase classes
PrelNum Class: Num, plus instances for Int
Type: Integer, plus instances for all classes so far (Eq, Ord, Num, Show)
Integer is needed here because it is mentioned in the signature
of 'fromInteger' in class Num
PrelReal Classes: Real, Integral, Fractional, RealFrac
plus instances for Int, Integer
Types: Ratio, Rational
plus intances for classes so far
Rational is needed here because it is mentioned in the signature
of 'toRational' in class Real
Ix Classes: Ix, plus instances for Int, Bool, Char, Integer, Ordering, tuples
PrelArr Types: Array, MutableArray, MutableVar
Does *not* contain any ByteArray stuff (see PrelByteArr)
Arrays are used by a function in PrelFloat
PrelFloat Classes: Floating, RealFloat
Types: Float, Double, plus instances of all classes so far
This module contains everything to do with floating point.
It is a big module (900 lines)
With a bit of luck, many modules can be compiled without ever reading PrelFloat.hi
PrelByteArr Types: ByteArray, MutableByteArray
We want this one to be after PrelFloat, because it defines arrays
of unboxed floats.
Other Prelude modules are much easier with fewer complex dependencies.
Diffstat (limited to 'ghc/docs')
-rw-r--r-- | ghc/docs/users_guide/debugging.vsgml | 46 | ||||
-rw-r--r-- | ghc/docs/users_guide/using.vsgml | 37 |
2 files changed, 42 insertions, 41 deletions
diff --git a/ghc/docs/users_guide/debugging.vsgml b/ghc/docs/users_guide/debugging.vsgml index 2d99076ec7..f3fed156e4 100644 --- a/ghc/docs/users_guide/debugging.vsgml +++ b/ghc/docs/users_guide/debugging.vsgml @@ -104,7 +104,7 @@ output) by using @-ddump-all@, or most of them with @-ddump-most@. Some of the most useful ones are: <descrip> -<tag>@-ddump-parsed@:</tag> oarser output +<tag>@-ddump-parsed@:</tag> parser output <tag>@-ddump-rn@:</tag> renamer output <tag>@-ddump-tc@:</tag> typechecker output <tag>@-ddump-deriv@:</tag> derived instances @@ -122,6 +122,10 @@ Some of the most useful ones are: <tag>@-ddump-flatC@:</tag> <em>flattened</em> Abstract~C <tag>@-ddump-realC@:</tag> same as what goes to the C compiler <tag>@-ddump-asm@:</tag> assembly language from the native-code generator +<tag>@-ddump-most@:</tag> most of the above, plus @-dshow-passes@, @-dsource-stats@, @-ddump-simpl-stats@, +<tag>@-ddump-all@:</tag> all the above, plus @-ddump-inlinings@, +@-ddump-simpl-iterations@, @-ddump-rn-trace@, +@-ddump-verbose-simpl@, @-ddump-verbose-stg@. </descrip> <nidx>-ddump-all option</nidx>% @@ -331,43 +335,3 @@ Main.skip2{-r1L6-} = trademark of Peyton Jones Enterprises, plc.) %---------------------------------------------------------------------- -<sect2>Command line options in source files -<label id="source-file-options"> -<p> -<nidx>source-file options</nidx> - -Sometimes it is useful to make the connection between a source file -and the command-line options it requires quite tight. For instance, -if a (Glasgow) Haskell source file uses @casm@s, the C back-end -often needs to be told about which header files to include. Rather than -maintaining the list of files the source depends on in a -@Makefile@ (using the @-#include@ command-line option), it is -possible to do this directly in the source file using the @OPTIONS@ -pragma <nidx>OPTIONS pragma</nidx>: - -<tscreen><verb> -{-# OPTIONS -#include "foo.h" #-} -module X where - -... -</verb></tscreen> - -@OPTIONS@ pragmas are only looked for at the top of your source -files, upto the first (non-literate,non-empty) line not containing -@OPTIONS@. Multiple @OPTIONS@ pragmas are recognised. Note -that your command shell does not get to the source file options, they -are just included literally in the array of command-line arguments -the compiler driver maintains internally, so you'll be desperately -disappointed if you try to glob etc. inside @OPTIONS@. - -NOTE: the contents of OPTIONS are prepended to the command-line -options, so you *do* have the ability to override OPTIONS settings -via the command line. - -It is not recommended to move all the contents of your Makefiles into -your source files, but in some circumstances, the @OPTIONS@ pragma -is the Right Thing. (If you use @-keep-hc-file-too@ and have OPTION -flags in your module, the OPTIONS will get put into the generated .hc -file). - -%---------------------------------------------------------------------- diff --git a/ghc/docs/users_guide/using.vsgml b/ghc/docs/users_guide/using.vsgml index 5de6c1a561..4507712034 100644 --- a/ghc/docs/users_guide/using.vsgml +++ b/ghc/docs/users_guide/using.vsgml @@ -891,6 +891,43 @@ construction of interface files, is (allegedly) in the works. %************************************************************************ %* * +<sect1>Command line options in source files +<label id="source-file-options"> +<p> +<nidx>source-file options</nidx> +%* * +%************************************************************************ + +GHC expects its flags on the command line, but it is also possible +to embed them in the Haskell module itself, using the @OPTIONS@ +pragma <nidx>OPTIONS pragma</nidx>: +<tscreen><verb> + {-# OPTIONS -fglasgow-exts -fno-cpr-analyse #-} + module X where + + ... +</verb></tscreen> +@OPTIONS@ pragmas are only looked for at the top of your source +files, upto the first (non-literate,non-empty) line not containing +@OPTIONS@. Multiple @OPTIONS@ pragmas are recognised. Note +that your command shell does not get to the source file options, they +are just included literally in the array of command-line arguments +the compiler driver maintains internally, so you'll be desperately +disappointed if you try to @glob@ etc. inside @OPTIONS@. + +The contents of @OPTIONS@ are prepended to the command-line +options, so you *do* have the ability to override @OPTIONS@ settings +via the command line. + +It is not recommended to move all the contents of your Makefiles into +your source files, but in some circumstances, the @OPTIONS@ pragma +is the Right Thing. (If you use @-keep-hc-file-too@ and have @OPTIONS@ +flags in your module, the @OPTIONS@ will get put into the generated .hc +file). + + +%************************************************************************ +%* * <sect1>Optimisation (code improvement) <label id="options-optimise"> <p> |