Test Trac #9036
[ghc.git] / docs / comm / rts-libs / prelfound.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
5 <title>The GHC Commentary - Prelude Foundations</title>
6 </head>
7
8 <body BGCOLOR="FFFFFF">
9 <h1>The GHC Commentary - Prelude Foundations</h1>
10 <p>
11 The standard Haskell Prelude as well as GHC's Prelude extensions are
12 constructed from GHC's <a href="primitives.html">primitives</a> in a
13 couple of layers.
14
15 <h4><code>PrelBase.lhs</code></h4>
16 <p>
17 Some most elementary Prelude definitions are collected in <a
18 href="http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/ghc/lib/std/PrelBase.lhs"><code>PrelBase.lhs</code></a>.
19 In particular, it defines the boxed versions of Haskell primitive types
20 - for example, <code>Int</code> is defined as
21 <blockquote><pre>
22 data Int = I# Int#</pre>
23 </blockquote>
24 <p>
25 Saying that a boxed integer <code>Int</code> is formed by applying the
26 data constructor <code>I#</code> to an <em>unboxed</em> integer of type
27 <code>Int#</code>. Unboxed types are hardcoded in the compiler and
28 exported together with the <a href="primitives.html">primitive
29 operations</a> understood by GHC.
30 <p>
31 <code>PrelBase.lhs</code> similarly defines basic types, such as,
32 boolean values
33 <blockquote><pre>
34 data Bool = False | True deriving (Eq, Ord)</pre>
35 </blockquote>
36 <p>
37 the unit type
38 <blockquote><pre>
39 data () = ()</pre>
40 </blockquote>
41 <p>
42 and lists
43 <blockquote><pre>
44 data [] a = [] | a : [a]</pre>
45 </blockquote>
46 <p>
47 It also contains instance delarations for these types. In addition,
48 <code>PrelBase.lhs</code> contains some <a href="prelude.html">tricky
49 machinery</a> for efficient list handling.
50
51 <p><small>
52 <!-- hhmts start -->
53 Last modified: Wed Aug 8 19:30:18 EST 2001
54 <!-- hhmts end -->
55 </small>
56 </body>
57 </html>