[project @ 1996-07-19 18:36:04 by partain]
[ghc-hetmet.git] / ghc / docs / NOTES.core-overview
1 \documentstyle[11pt,a4wide]{article}
2 \begin{document}
3
4 %****************************************
5 %*                                      *
6 %*              The Core language                       *
7 %*                                      *
8 %****************************************
9
10
11 \title{The Core language}
12 \author{Simon L Peyton Jones \and 
13 Will Partain \and
14 Patrick Sansom}
15
16 \maketitle
17
18 \section{Introduction}
19
20 This document describes the Glasgow Haskell Core-language data type 
21 in sufficient detail for an implementor to be able to use it.
22
23 \section{Overview}
24
25 The Core language is, roughly speaking, the second-order polymorphic
26 lambda calculus, augmented with @let@, @letrec@ and @case@.
27 It is a Haskell data type (defined shortly), but for convenience in this
28 document we give it the concrete syntax given in Figure~\ref{fig:core-syntax}.
29
30 Here are some of its important characteristics:
31 \begin{description}
32 \item[The Core language includes the second-order lambda calculus.]
33 That is, type abstraction and type application are provided.
34 \item[Constructors and primitive operators are always saturated.]
35 This is easily done by adding extra lambdas and performing $\eta$-expansion.
36 \item[All pattern-matching is done by simple @case@ expressions.]
37 The @case@ expressions are simple in the sense that their patterns
38 have only one level.
39 \item[Every identifier includes its type.]
40 This is not immediately obvious from the syntax, but will be fleshed out
41 later.  The point is that it is easy to tell the type of any identifier or,
42 in general, any Core expression.
43 \item[There is no shadowing.]  
44 Identifiers may not be globally unique,
45 but there are no ``holes in the scope'' of any identifier.
46 \end{description}
47 All these properties should be maintained by programs which manipulate Core-langauge
48 programs.
49
50 \section{Identifiers: the type @Id@}
51
52 Identifiers have the (abstract) type @Id@. 
53 \begin{description}
54 \item[Equality.]
55 Identifiers have a unique number inside them,
56 so they can be compared efficiently for equality.
57 They are an instance of the class @Eq@.
58 \item[Type.]
59 The function 
60 \begin{verbatim}
61         getIdUniType :: Id -> UniType
62 \end{verbatim}
63  gets the type of an identifer.
64  \end{description}
65  
66  \section{Types: the type @UniType@}
67  
68  \subsection{@TyCon@}
69  
70  The type @TyCon@ ranges over {\em data} type constructors,
71  not over the function type constructor.
72  
73  A @TyCon@ can be one of:
74  \begin{itemize}
75  \item A primitive type.
76  \item A tuple type.
77  \item An algebraic data type (other than tuples).
78  \end{itemize}
79  
80  \section{The Core language data type}
81  
82  \subsection{@coreExpr@}
83
84 Tycon in @case@.
85
86 \subsection{@coreBinding@}
87
88 \subsection{@coreProgram@}
89
90 \subsection{@plainCore@ things}
91
92
93
94 \end{document}