[project @ 2000-08-07 23:37:19 by qrczak]
[ghc-hetmet.git] / ghc / docs / users_guide / vs_haskell.sgml
1 <Sect1 id="vs-Haskell-defn">
2 <Title>Haskell&nbsp;98 vs.&nbsp;Glasgow Haskell: language non-compliance
3 </Title>
4
5 <Para>
6 <IndexTerm><Primary>GHC vs the Haskell 98 language</Primary></IndexTerm>
7 <IndexTerm><Primary>Haskell 98 language vs GHC</Primary></IndexTerm>
8 </Para>
9
10 <Para>
11 This section lists Glasgow Haskell infelicities in its implementation
12 of Haskell&nbsp;98.  See also the &ldquo;when things go wrong&rdquo; section
13 (<XRef LinkEnd="wrong">)
14 for information about crashes, space leaks, and other undesirable
15 phenomena.
16 </Para>
17
18 <Para>
19 The limitations here are listed in Haskell-Report order (roughly).
20 </Para>
21
22 <Sect2 id="infelicities-exprs-pats">
23 <Title>Expressions and patterns
24 </Title>
25
26 <Para>
27 <VariableList>
28
29 <VarListEntry>
30 <Term>Very long <Literal>String</Literal> constants:</Term>
31 <ListItem>
32 <Para>
33 May not go through.  If you add a &ldquo;string gap&rdquo; every
34 few thousand characters, then the strings can be as long
35 as you like.
36 </Para>
37
38 <Para>
39 Bear in mind that string gaps and the <Option>-cpp</Option><IndexTerm><Primary>-cpp option</Primary></IndexTerm>
40 option don't mix very well (see <XRef LinkEnd="c-pre-processor">).
41 </Para>
42 </ListItem>
43 </VarListEntry>
44 <VarListEntry>
45 <Term>Single quotes in module names:</Term>
46 <ListItem>
47 <Para>
48 It might work, but it's just begging for trouble.
49 </Para>
50 </ListItem>
51 </VarListEntry>
52 </VariableList>
53 </Para>
54
55 </Sect2>
56
57 <Sect2 id="infelicities-decls">
58 <Title>Declarations and bindings
59 </Title>
60
61 <Para>
62 None known.
63 </Para>
64
65 </Sect2>
66
67 <Sect2 id="infelicities-Modules">
68 <Title>Module system and interface files
69 </Title>
70
71 <Para>
72 <VariableList>
73
74 <VarListEntry>
75 <Term> Namespace pollution </Term>
76 <ListItem>
77 <Para>
78 Several modules internal to GHC are visible in the standard namespace.
79 All of these modules begin with <Literal>Prel</Literal>, so the rule
80 is: don't use any modules beginning with <Literal>Prel</Literal> in
81 your program, or you will be comprehensively screwed.
82 </Para>
83 </ListItem>
84 </VarListEntry>
85 </VariableList>
86 </Para>
87
88 </Sect2>
89
90 <Sect2 id="infelicities-numbers">
91 <Title>Numbers, basic types, and built-in classes
92 </Title>
93
94 <Para>
95 <VariableList>
96
97 <VarListEntry>
98 <Term>Unchecked arithmetic:</Term>
99 <ListItem>
100 <Para>
101 Arguably <Emphasis>not</Emphasis> an infelicity, but&hellip; Bear in
102 mind that operations on <Literal>Int</Literal>,
103 <Literal>Float</Literal>, and <Literal>Double</Literal> numbers are
104 <Emphasis>unchecked</Emphasis> for overflow, underflow, and other sad
105 occurrences.  (note, however that some architectures trap
106 floating-point overflow and loss-of-precision and report a
107 floating-point exception, probably terminating the
108 program)<IndexTerm><Primary>floating-point
109 exceptions</Primary></IndexTerm>.
110 </Para>
111
112 <Para>
113 Use <Literal>Integer</Literal>, <Literal>Rational</Literal>, etc.,
114 numeric types if this stuff keeps you awake at night.
115 </Para>
116 </ListItem>
117 </VarListEntry>
118 <VarListEntry>
119 <Term>Multiply-defined array elements&mdash;not checked:</Term>
120 <ListItem>
121 <Para>
122 This code fragment <Emphasis>should</Emphasis> elicit a fatal error, but it does not:
123
124 <ProgramListing>
125 main = print (array (1,1) [(1,2), (1,3)])
126 </ProgramListing>
127
128 </Para>
129 </ListItem>
130 </VarListEntry>
131 </VariableList>
132 </Para>
133
134 </Sect2>
135
136 <Sect2 id="infelicities-Prelude">
137 <Title>In Prelude support
138 </Title>
139
140 <Para>
141 <VariableList>
142
143 <VarListEntry>
144 <Term>Arbitrary-sized tuples:</Term>
145 <ListItem>
146 <Para>
147 Plain old tuples of arbitrary size <Emphasis>do</Emphasis> work.
148 </Para>
149
150 <Para>
151 HOWEVER: standard instances for tuples (<Literal>Eq</Literal>, <Literal>Ord</Literal>, <Literal>Bounded</Literal>, <Literal>Ix</Literal>
152 <Literal>Read</Literal>, and <Literal>Show</Literal>) are available <Emphasis>only</Emphasis> up to 5-tuples.
153 </Para>
154
155 <Para>
156 These limitations are easily subvertible, so please ask if you get
157 stuck on them.
158 </Para>
159 </ListItem>
160 </VarListEntry>
161 </VariableList>
162 </Para>
163
164 </Sect2>
165
166 </Sect1>
167
168 <!-- Emacs stuff:
169      ;;; Local Variables: ***
170      ;;; mode: sgml ***
171      ;;; sgml-parent-document: ("users_guide.sgml" "book" "chapter" "sect1") ***
172      ;;; End: ***
173  -->