[project @ 1999-03-16 17:07:21 by simonm]
[ghc-hetmet.git] / ghc / docs / users_guide / vs_haskell.vsgml
1 %************************************************************************
2 %*                                                                      *
3 <sect1>Haskell~98 vs.~Glasgow Haskell: language non-compliance
4 <label id="vs-Haskell-defn">
5 <p>
6 <nidx>GHC vs the Haskell 98 language</nidx>
7 <nidx>Haskell 98 language vs GHC</nidx>
8 %*                                                                      *
9 %************************************************************************
10
11 This section lists Glasgow Haskell infelicities in its implementation
12 of Haskell~98.  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 for records:</tag> Hmmm.
60 </descrip>
61
62 %************************************************************************
63 %*                                                                      *
64 <sect2>Module system and interface files
65 <label id="infelicities-Modules">
66 <p>
67 %*                                                                      *
68 %************************************************************************
69
70 <descrip>
71 %-------------------------------------------------------------------
72 <tag> Namespace pollution </tag>
73
74 Several modules internal to GHC are visible in the standard namespace.
75 All of these modules begin with @Prel@, so the rule is: don't use any
76 modules beginning with @Prel@ in your program, or you will be
77 comprehensively screwed.
78
79 </descrip>
80
81 %************************************************************************
82 %*                                                                      *
83 <sect2>Numbers, basic types, and built-in classes
84 <label id="infelicities-numbers">
85 <p>
86 %*                                                                      *
87 %************************************************************************
88
89 <descrip>
90 %-------------------------------------------------------------------
91 <tag>Unchecked arithmetic:</tag>
92
93 Arguably <em>not</em> an infelicity, but... Bear in mind that
94 operations on @Int@, @Float@, and @Double@ numbers are
95 <em>unchecked</em> for overflow, underflow, and other sad occurrences.
96 (note, however that some architectures trap floating-point overflow
97 and loss-of-precision and report a floating-point
98 exception)<nidx>floating-point exceptions</nidx>.
99
100 Use @Integer@, @Rational@, etc., numeric types if this stuff
101 keeps you awake at night.
102
103 %-------------------------------------------------------------------
104 <tag>Multiply-defined array elements---not checked:</tag>
105 This code fragment <em>should</em> elicit a fatal error, but it does not:
106 <tscreen><verb>
107 main = print (array (1,1) [ 1:=2, 1:=3 ])
108 </verb></tscreen>
109 </descrip>
110
111 %************************************************************************
112 %*                                                                      *
113 <sect2>In Prelude support
114 <label id="infelicities-Prelude">
115 <p>
116 %*                                                                      *
117 %************************************************************************
118
119 <descrip>
120 %-------------------------------------------------------------------
121 <tag>Arbitrary-sized tuples:</tag>
122 Plain old tuples of arbitrary size <em>do</em> work.
123
124 HOWEVER: standard instances for tuples (@Eq@, @Ord@, @Bounded@, @Ix@
125 @Read@, and @Show@) are available <em>only</em> up to 5-tuples.
126
127 These limitations are easily subvertible, so please ask if you get
128 stuck on them.
129
130 %-------------------------------------------------------------------
131 <tag>Unicode character set:</tag>
132 Haskell 98 embraces the Unicode character set, but GHC doesn't
133 handle it. Yet.
134
135 </descrip>