summaryrefslogtreecommitdiff
path: root/ghc/docs/comm/rts-libs/prelfound.html
blob: 25407eed43c7433a2fbede4ad71a8250da8e011a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
  <head>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
    <title>The GHC Commentary - Prelude Foundations</title>
  </head>

  <body BGCOLOR="FFFFFF">
    <h1>The GHC Commentary - Prelude Foundations</h1>
    <p>
      The standard Haskell Prelude as well as GHC's Prelude extensions are
      constructed from GHC's <a href="primitives.html">primitives</a> in a
      couple of layers.  

    <h4><code>PrelBase.lhs</code></h4>
    <p>
      Some most elementary Prelude definitions are collected in <a
	href="http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/ghc/lib/std/PrelBase.lhs"><code>PrelBase.lhs</code></a>.
      In particular, it defines the boxed versions of Haskell primitive types
      - for example, <code>Int</code> is defined as
    <blockquote><pre>
data Int = I# Int#</pre>
    </blockquote>
    <p>
      Saying that a boxed integer <code>Int</code> is formed by applying the
      data constructor <code>I#</code> to an <em>unboxed</em> integer of type
      <code>Int#</code>.  Unboxed types are hardcoded in the compiler and
      exported together with the <a href="primitives.html">primitive
	operations</a> understood by GHC.
    <p>
      <code>PrelBase.lhs</code> similarly defines basic types, such as,
      boolean values
    <blockquote><pre>
data  Bool  =  False | True  deriving (Eq, Ord)</pre>
    </blockquote>
    <p>
      the unit type
    <blockquote><pre>
data  ()  =  ()</pre>
    </blockquote>
    <p>
      and lists
    <blockquote><pre>
data [] a = [] | a : [a]</pre>
    </blockquote>
    <p>
      It also contains instance delarations for these types.  In addition,
      <code>PrelBase.lhs</code> contains some <a href="prelude.html">tricky
      machinery</a> for efficient list handling.

    <p><small>
<!-- hhmts start -->
Last modified: Wed Aug  8 19:30:18 EST 2001
<!-- hhmts end -->
    </small>
  </body>
</html>