---
name: "nhc98"
section: "1"
platform: "linux"
package: "nhc98"
version: "1.16-15"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/nhc98"
---

# nhc98(1)

a compiler for Haskell 98

## NAME

nhc98 - a compiler for Haskell 98

## SYNOPSIS

**nhc98** \[ option \] files

## DESCRIPTION

The syntax of *nhc98* programs is described in the Haskell 98 report.

This manual page is incomplete and probably somewhat out-of-date.  See the supplied html documentation (default location /usr/doc/nhc98) for full details of your local installation, or visit  *http://www.cs.york.ac.uk/fp/nhc98/* for the latest details.

*nhc98* accepts several types of arguments:\
 Arguments whose names end in \`.hs' are taken to be Haskell source, names ending in \`.lhs' are taken to be literate Haskell source, names ending in \`.gc' are taken to be GreenCard source, names ending in \`.hc' are taken to be *nhc98* bytecode, names ending in \`.c' are taken to be straight C code, names ending in \`.s' are taken to be assembler programs and \`.o' are object files.

The following options are interpreted by  *nhc98*

- **-C**

  Suppress the loading phase and force a bytecode file to be produced.

- **-S**

  Suppress the loading phase and force an assembler file to be produced.

- **-c**

  Suppress the loading phase and force an object file to be produced.

- **-o** *output*

  Name the output file *output*.

- **-I***path/*

  Prepend *path* to the list of paths used to locate interface files.  The  *path* should be a directory. Nhc98 will try to link with *path/$MACHINE/lib.a,* or if it does not exist with *path/lib.a* ( *libp.a* is used instead of *lib.a* when linking code for heap profiling, and likewise *libt.a* for time profiling, and *libT.a* for tracing).

- **-\[lL\]\***

  Extra libraries that are sent directly to the linker.

- **-p**

  Emit code that enables heap profiling. Additional flags (see below) are needed when the program is run. Use hp2graph to get a PostScript file.

- **-t**

  Emit code that enables time profiling. Additional run-time flags are needed to guide the profile.

- **-T**

  Emit code that enables tracing. Additional compile-time flags (see below) can be given to guide the progress of tracing.

- **-cpp**

  run the C preprocessor before compilation.

- **-v**

  be verbose.

- **--version**

  report which compiler version is installed.

- **+RTS**

  Interpret arguments as flags to the compilers runtime system, until *-RTS* or all arguments are interpreted.

- **+CTS**

  Interpret arguments as flags to the compiler, until *-CTS* or all arguments are interpreted. Useful to force arguments that starts with *-l* to the compiler instead of the linker.

When the program is run it interprets the following flags:

- **+RTS**

  Interpret arguments as flags to the runtime system until *-RTS* or all arguments are interpreted.

The runtime flags are:

- **-Hsize**

  set the heapsize to *size*. Default is 400kbyte.

- **-Ksize**

  set the stacksize to *size*. Default is 80kbyte.

- **-B**

  makes the bell sound at each garbage collection.

If the program is compiled with  *-p* then additional runtime flags are available. The first occurence of  *-p, -m, -c, -r, -b* or *-l* determines which kind of heap profile that should be produced. Only  *-r* can take an argument in this case (the size when retainer sets should be approximated with everyone). Later occurrences restrict the profile to nodes that match the arguments.

- **-p\[p1:...\]**

  Heap profiling by *producer* (function).

- **-m\[m1:...\]**

  Heap profiling by *module.*

- **-c\[c1:...\]**

  Heap profiling by *construction.*

- **-r\[r1:...\]**

  Heap profiling by *retainer.*

- **-b\[lag\|use\|drag\|void\]**

  *Biographical* heap profiling.

- **-l\[\[low\]-\[high\]\]**

  Heap profiling by *lifetime.*

- **-@**

  Count apply nodes as retainers.

There may be more flags (they multiply).

## ENVIRONMENT

The environment variables NHC98LIBDIR and NHC98INCDIR are used to find the various files used by the compiler.  The default values are /usr/local/lib/nhc98 and /usr/local/include/nhc98.  The variable $MACHINE is used to select the correct executables and libraries for your architecture. It is determined using the script *harch*

## FILES

- **$NHC98LIBDIR/$MACHINE/nhc98comp**

  the compiler.

- **$NHC98INCDIR/\*.hi**

  interface files.

- **$NHC98LIBDIR/$MACHINE/Runtime\[ptT\]?.o**

  part of the runtime system.

- **$NHC98LIBDIR/$MACHINE/Runtime\[ptT\]?.a**

  the rest of the runtime system.

- **$NHC98LIBDIR/$MACHINE/Prelude\[ptT\]?.a**

  the standard prelude and libraries.

## DIAGNOSTICS

Could be better, could be worse.

## SEE ALSO

[hmake(1)](/hmake/1.md), [hp2graph(1)](/hp2graph/1.md), harch(1)

## BUGS

Probably.\
 Make sure that the function called "main" in module Main has the type *IO ()* as the compiler won't tell you if you get it wrong!
