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 <Option>-cpp</Option><IndexTerm><Primary>-cpp option</Primary></IndexTerm>
40 option don't mix very well (see <XRef LinkEnd="c-pre-processor">).
45 <Term>Single quotes in module names:</Term>
48 It might work, but it's just begging for trouble.
57 <Sect2 id="infelicities-decls">
58 <Title>Declarations and bindings
67 <Sect2 id="infelicities-Modules">
68 <Title>Module system and interface files
75 <Term> Namespace pollution </Term>
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.
90 <Sect2 id="infelicities-numbers">
91 <Title>Numbers, basic types, and built-in classes
98 <Term>Unchecked arithmetic:</Term>
101 Arguably <Emphasis>not</Emphasis> an infelicity, but… 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>.
113 Use <Literal>Integer</Literal>, <Literal>Rational</Literal>, etc.,
114 numeric types if this stuff keeps you awake at night.
119 <Term>Multiply-defined array elements—not checked:</Term>
122 This code fragment <Emphasis>should</Emphasis> elicit a fatal error, but it does not:
125 main = print (array (1,1) [(1,2), (1,3)])
136 <Sect2 id="infelicities-Prelude">
137 <Title>In Prelude support
144 <Term>Arbitrary-sized tuples:</Term>
147 Plain old tuples of arbitrary size <Emphasis>do</Emphasis> work.
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.
156 These limitations are easily subvertible, so please ask if you get
169 ;;; Local Variables: ***
171 ;;; sgml-parent-document: ("users_guide.sgml" "book" "chapter" "sect1") ***