The Hugs 98 User Manual
top | back | next

## 9`` Conformance with Haskell 98

A number of Haskell 98 features are not yet implemented in Hugs 98. All known differences between the specification and implementation are described in this section, although there are bound to be some unintentional omissions.

### 9.1`` Haskell 98 features not in Hugs

- Mutually recursive modules are not supported.
- Some library functions have been moved into the Prelude. This is necessary because the Prelude and the standard libraries, as defined in the Haskell 98 report, are mutually recursive. This mutual recursion has been avoided by moving the following functions into the Prelude:
  - From `Ix`: `Ix(range, index, inRange, rangeSize)`.
  - From `Char`: `isAscii`, `isControl`, `isPrint`, `isSpace`, `isUpper`, `isLower`, `isAlpha`, `isDigit`, `isOctDigit`, `isHexDigit`, `isAlphanum`, `digitToInt`, `intToDigit`, `toUpper`, `toLower`, `ord`, and `chr`.
  - From `Ratio`: `Ratio`, `Rational`, `(%)`, `numerator`, `denominator`, and `approxRational`.
- Derived `Read` instances do not work for some infix constructors. If an infix constructor has left associativity and the type appears recursively on the left side of the constructor, then the read instance will loop.
- Hugs does not allow the use of qualified names in instance declarations.
- Hugs does not use the Unicode character set yet. Characters are currently drawn from the ISO Latin-1 set.
- Two adjacent dashes `--` start a one line comment; for strictly technical reasons, the change from Haskell 1.4 to Haskell 98 to use maximal munch for such comments has not yet been implemented.
- The floating point printer is not exactly as defined in the report. The printed form of a floating point number may re-read as a slightly different number.
- Derived instances for large tuples are not supplied. Instances for tuples larger than 5 (3 in the 16 bit PC system) are not in the Prelude.
- When using `getArgs`, only the stand-alone system passes arguments to the executing program. The interactive system always uses an empty argument list when runnning a program.
- The syntax of sections is slightly different. For example, the Haskell expression `(2*3+)` must instead be written as `((2*3)+)`.
- Instead of `IO.hIsEOF`, hugs provides `IO.hugsHIsEOF`. Whereas `hIsEOF` should tell you if the next call of `hGetChar` would raise an EOF error; `hugsHIsEOF` tells you if the last call of `hGetCHar` raised an EOF error (the same as ANSI C's `feof`).
- We ignore entity lists in qualified imports (but unqualified imports are treated correctly). For example, you can write: `
  import qualified Prelude ( foo )
  ` even though `foo` is not exported from the Prelude and you can write: `
  module M() where
  import qualified Prelude () -- import nothing
  x = Prelude.length "abcd"
  `
- The `Double` type is implemented as a single precision float (this isn't forbidden by the standard but it is unusual).

### 9.2`` Libraries

The following libraries are not yet available: `Directory`, `Time`, `CPUTime`, `Bit`, `Nat`, and `Signed`.

In the IO library, these functions are not defined: `handlePosn`, `ReadWriteMode` h`FileSize`, `hIsEOF`, `isEOF`, `hSetBuffering`, `hGetBuffering`, `hSeek`, `hIsSeekable`, `hReady`, and `hLookahead`. The following non-standard functions are exported: `
hugsGetCh :: IO Char -- getchar without echoing to screen
hugsHIsEOF :: Handle -> IO Bool
-- same semantics as C's "feof" (different from Haskell's hIsEOF)
hugsIsEOF :: IO Bool
-- same semantics as C's "feof(stdin)"
hPutStrLn :: String -> IO ()
-- corresponds to Prelude.putStrLn
`

### 9.3`` Haskell 98 extensions

In addition to the features described in Section 7, Hugs 98 supports some modest extensions to the Haskell language.

- Import declarations may specify a file name instead of a module name.
- The T(..) syntax is allowed for type synonyms in import and export lists.

The Hugs 98 User Manual
top | back | next
May 22, 1999