[project @ 1998-12-02 13:17:09 by simonm]
[ghc-hetmet.git] / ghc / docs / users_guide / vs_haskell.vsgml
1 %************************************************************************
2 %*                                                                      *
3 <sect1>Haskell~1.4 vs.~Glasgow Haskell~4.00: language non-compliance
4 <label id="vs-Haskell-defn">
5 <p>
6 <nidx>GHC vs the Haskell 1.4 language</nidx>
7 <nidx>Haskell 1.4 language vs GHC</nidx>
8 %*                                                                      *
9 %************************************************************************
10
11 This section lists Glasgow Haskell infelicities in its implementation
12 of Haskell~1.4.  See also the ``when things go wrong'' section
13 (Section <ref name="What to do when something goes wrong" id="wrong">)
14 for information about crashes, space leaks, and other undesirable
15 phenomena.
16
17 The limitations here are listed in Haskell-Report order (roughly).
18
19 %************************************************************************
20 %*                                                                      *
21 <sect2>Expressions and patterns
22 <label id="infelicities-exprs-pats">
23 <p>
24 %*                                                                      *
25 %************************************************************************
26
27 <descrip>
28
29 %-------------------------------------------------------------------
30 <tag>Very long @String@ constants:</tag>
31 May not go through.  If you add a ``string gap'' every
32 few thousand characters, then the strings can be as long
33 as you like.
34
35 Bear in mind that string gaps and the @-cpp@<nidx>-cpp option</nidx>
36 option don't mix very well (see Section <ref id="c-pre-processor"
37 name="The C pre-processor">).
38
39 %-------------------------------------------------------------------
40 <tag>Very long literal lists:</tag>
41 These may tickle a ``yacc stack overflow'' error in the parser.
42 (It depends on the Yacc used to build your parser.)
43
44 %-------------------------------------------------------------------
45 <tag>Single quotes in module names:</tag>
46 It might work, but it's just begging for trouble.
47 </descrip>
48
49 %************************************************************************
50 %*                                                                      *
51 <sect2>Declarations and bindings
52 <label id="infelicities-decls">
53 <p>
54 %*                                                                      *
55 %************************************************************************
56
57 <descrip>
58 %-------------------------------------------------------------------
59 <tag>Derived instances of @Read@ and @Show@ for infix constructors:</tag>
60 All the carry-on about derived @readsPrec@ and @showsPrec@ for infix
61 constructors---we don't do it (yet).  We treat them the same way as
62 all other constructors.
63
64 %-------------------------------------------------------------------
65 <tag>Derived instances for records:</tag> Hmmm.
66 </descrip>
67
68 %************************************************************************
69 %*                                                                      *
70 <sect2>Module system and interface files
71 <label id="infelicities-Modules">
72 <p>
73 %*                                                                      *
74 %************************************************************************
75
76 <descrip>
77 %-------------------------------------------------------------------
78 <tag> Namespace pollution </tag>
79
80 Several modules internal to GHC are visible in the standard namespace.
81 All of these modules begin with @Prel@, so the rule is: don't use any
82 modules beginning with @Prel@ in your program, or you will be
83 comprehensively screwed.
84
85 % Not true anymore? -- Simon M.
86 %-------------------------------------------------------------------
87 % <tag>Can't export primitive types (e.g., @Int#@):</tag>
88 % Don't even try...
89
90 </descrip>
91
92 %************************************************************************
93 %*                                                                      *
94 <sect2>Numbers, basic types, and built-in classes
95 <label id="infelicities-numbers">
96 <p>
97 %*                                                                      *
98 %************************************************************************
99
100 <descrip>
101 % Not true anymore? We use Rationals all the way -- Simon M.
102 %-------------------------------------------------------------------
103 % <tag>Very large/small fractional constants:</tag>
104 % (i.e., with a decimal point somewhere) GHC does not check that these
105 % are out of range (e.g., for a @Float@), and bad things will inevitably
106 % follow.  (To be corrected?)
107
108 % This problem does <em>not</em> exist for integral constants.
109
110 % For very large/small fractional constants near the limits of your
111 % floating-point precision, things may go wrong.  (It's better than it
112 % used to be.)  Please report any such bugs.
113
114 %-------------------------------------------------------------------
115 <tag>Unchecked arithmetic:</tag>
116
117 Arguably <em>not</em> an infelicity, but... Bear in mind that
118 operations on @Int@, @Float@, and @Double@ numbers are
119 <em>unchecked</em> for overflow, underflow, and other sad occurrences.
120 (note, however that some architectures trap floating-point overflow
121 and loss-of-precision and report a floating-point
122 exception)<nidx>floating-point exceptions</nidx>.
123
124 Use @Integer@, @Rational@, etc., numeric types if this stuff
125 keeps you awake at night.
126
127 %-------------------------------------------------------------------
128 <tag>Multiply-defined array elements---not checked:</tag>
129 This code fragment <em>should</em> elicit a fatal error, but it does not:
130 <tscreen><verb>
131 main = print (array (1,1) [ 1:=2, 1:=3 ])
132 </verb></tscreen>
133 </descrip>
134
135 %************************************************************************
136 %*                                                                      *
137 <sect2>In Prelude support
138 <label id="infelicities-Prelude">
139 <p>
140 %*                                                                      *
141 %************************************************************************
142
143 <descrip>
144 %-------------------------------------------------------------------
145 <tag>Arbitrary-sized tuples:</tag>
146 Plain old tuples of arbitrary size <em>do</em> work.  Note that lots of
147 overloading can give rise to large tuples ``under the hood'' of your
148 program.
149
150 HOWEVER: standard instances for tuples (@Eq@, @Ord@, @Bounded@, @Ix@
151 @Read@, and @Show@) are available <em>only</em> up to 5-tuples.
152
153 These limitations are easily subvertible, so please ask if you get
154 stuck on them.
155
156 %-------------------------------------------------------------------
157 <tag>Unicode character set:</tag>
158 Haskell 1.4 embraces the Unicode character set, but GHC 4.00 doesn't
159 handle it. Yet.
160
161 </descrip>