6.13. Haskell 98 vs. Glasgow Haskell: language non-compliance

This section lists Glasgow Haskell infelicities in its implementation of Haskell 98. See also the “when things go wrong” section (Chapter 7) for information about crashes, space leaks, and other undesirable phenomena.

The limitations here are listed in Haskell-Report order (roughly).

6.13.1. Expressions and patterns

Very long String constants:

May not go through. If you add a “string gap” every few thousand characters, then the strings can be as long as you like.

Bear in mind that string gaps and the -cpp option don't mix very well (see Section 3.9.1).

Very long literal lists:

These may tickle a “yacc stack overflow” error in the parser. (It depends on the Yacc used to build your parser.)

Single quotes in module names:

It might work, but it's just begging for trouble.

6.13.2. Declarations and bindings

Derived instances for records:


6.13.3. Module system and interface files

Namespace pollution

Several modules internal to GHC are visible in the standard namespace. All of these modules begin with Prel, so the rule is: don't use any modules beginning with Prel in your program, or you will be comprehensively screwed.

6.13.4. Numbers, basic types, and built-in classes

Unchecked arithmetic:

Arguably not an infelicity, but… Bear in mind that operations on Int, Float, and Double numbers are unchecked for overflow, underflow, and other sad occurrences. (note, however that some architectures trap floating-point overflow and loss-of-precision and report a floating-point exception).

Use Integer, Rational, etc., numeric types if this stuff keeps you awake at night.

Multiply-defined array elements—not checked:

This code fragment should elicit a fatal error, but it does not:
main = print (array (1,1) [ 1:=2, 1:=3 ])

6.13.5. In Prelude support

Arbitrary-sized tuples:

Plain old tuples of arbitrary size do work.

HOWEVER: standard instances for tuples (Eq, Ord, Bounded, Ix Read, and Show) are available only up to 5-tuples.

These limitations are easily subvertible, so please ask if you get stuck on them.

Unicode character set:

Haskell 98 embraces the Unicode character set, but GHC doesn't handle it. Yet.