1 <Sect1 id="vs-Haskell-defn">
2 <Title>Haskell 98 vs. Glasgow Haskell: language non-compliance
6 <IndexTerm><Primary>GHC vs the Haskell 98 language</Primary></IndexTerm>
7 <IndexTerm><Primary>Haskell 98 language vs GHC</Primary></IndexTerm>
11 This section lists Glasgow Haskell infelicities in its implementation
12 of Haskell 98. See also the ``when things go wrong'' section
13 (<XRef LinkEnd="wrong">)
14 for information about crashes, space leaks, and other undesirable
19 The limitations here are listed in Haskell-Report order (roughly).
22 <Sect2 id="infelicities-exprs-pats">
23 <Title>Expressions and patterns
30 <Term>Very long <Literal>String</Literal> constants:</Term>
33 May not go through. If you add a ``string gap'' every
34 few thousand characters, then the strings can be as long
39 Bear in mind that string gaps and the <Literal>-cpp</Literal><IndexTerm><Primary>-cpp option</Primary></IndexTerm>
40 option don't mix very well (see <XRef LinkEnd="c-pre-processor">).
45 <Term>Very long literal lists:</Term>
48 These may tickle a ``yacc stack overflow'' error in the parser.
49 (It depends on the Yacc used to build your parser.)
54 <Term>Single quotes in module names:</Term>
57 It might work, but it's just begging for trouble.
66 <Sect2 id="infelicities-decls">
67 <Title>Declarations and bindings
74 <Term>Derived instances for records:</Term>
86 <Sect2 id="infelicities-Modules">
87 <Title>Module system and interface files
94 <Term> Namespace pollution </Term>
97 Several modules internal to GHC are visible in the standard namespace.
98 All of these modules begin with <Literal>Prel</Literal>, so the rule is: don't use any
99 modules beginning with <Literal>Prel</Literal> in your program, or you will be
100 comprehensively screwed.
109 <Sect2 id="infelicities-numbers">
110 <Title>Numbers, basic types, and built-in classes
117 <Term>Unchecked arithmetic:</Term>
120 Arguably <Emphasis>not</Emphasis> an infelicity, but… Bear in mind that
121 operations on <Literal>Int</Literal>, <Literal>Float</Literal>, and <Literal>Double</Literal> numbers are
122 <Emphasis>unchecked</Emphasis> for overflow, underflow, and other sad occurrences.
123 (note, however that some architectures trap floating-point overflow
124 and loss-of-precision and report a floating-point
125 exception)<IndexTerm><Primary>floating-point exceptions</Primary></IndexTerm>.
129 Use <Literal>Integer</Literal>, <Literal>Rational</Literal>, etc., numeric types if this stuff
130 keeps you awake at night.
135 <Term>Multiply-defined array elements—not checked:</Term>
138 This code fragment <Emphasis>should</Emphasis> elicit a fatal error, but it does not:
141 main = print (array (1,1) [ 1:=2, 1:=3 ])
152 <Sect2 id="infelicities-Prelude">
153 <Title>In Prelude support
160 <Term>Arbitrary-sized tuples:</Term>
163 Plain old tuples of arbitrary size <Emphasis>do</Emphasis> work.
167 HOWEVER: standard instances for tuples (<Literal>Eq</Literal>, <Literal>Ord</Literal>, <Literal>Bounded</Literal>, <Literal>Ix</Literal>
168 <Literal>Read</Literal>, and <Literal>Show</Literal>) are available <Emphasis>only</Emphasis> up to 5-tuples.
172 These limitations are easily subvertible, so please ask if you get
178 <Term>Unicode character set:</Term>
181 Haskell 98 embraces the Unicode character set, but GHC doesn't