hugs, runhugs, ffihugs
Hugs 98, functional programming system
- Provided by: hugs (Version: 98.200609.21-6)
- Source: hugs98
- Report a bug
Hugs 98, functional programming system
hugs [ options ] [ modules ]
runhugs [ options ] module [ args ]
ffihugs [ options ] module [ compiler_argument ]
...
Hugs is an interpreter for Haskell, a standard non-strict functional programming language. Hugs implements almost all of the Haskell 98 standard, except for mutually recursive modules. The name Hugs is a mnemonic for the Haskell User's Gofer System.
The interpreter is started using the hugs command. After processing options, it loads the standard module Prelude and any other modules listed on the command line.
Each Haskell module is stored in a separate file. When loading a module name, Hugs replaces each `.' in name with a `/' and looks in each of the directories on its search path (see -P under OPTIONS) for the files name.hs and name.lhs. (The recognized suffixes may be changed using the -S option, described under OPTIONS.) It also tries name as a literal filename. Files ending in ".lhs" are treated as literate scripts.
Some options are toggled with + or - to turn them on or off, respectively.
Other options (in which - could be replaced by +, the choice making no difference) are:
Once the interpreter has been loaded, the following commands are available:
Any command may be abbreviated to :c where c is the first character in the full name. On most systems, you can also exit from Hugs by typing the end-of-file character (^D).
Note that the interrupt key (^C on most systems) can be used at any time whilst using Hugs to abandon the process of reading in a file of function definitions or the evaluation of an expression. When the interrupt is detected, Hugs prints the string "{Interrupted!}" and prints the prompt so that further commands can be entered.
The runhugs command is an interpreter for an executable Hugs script, which must contain a Haskell Main module. For example, the executable file hello might contain the lines
#!/usr/bin/runhugs +l > module Main where > main = putStr "Hello, World\n"
When this file is executed, runhugs will invoke the main function. Any arguments given on the command line will be available through getArgs.
Note that #! passes only one orgument to the script. The -X option may be used to get around this.
On architectures that support dynamic linking, Hugs implements the part of the Haskell 98 Foreign Function Interface (FFI) that allows Haskell functions to call C routines. (On the x86, PowerPC and Sparc architectures, all foreign imports are supported; on others, only static imports are provided.) Modules containing such foreign declarations must be compiled using the ffihugs command before use with hugs. Additional arguments for the C compiler may be supplied via compiler_arguments. For example, suppose you have some C functions in test.c and some FFI declarations for those functions in Test.hs and the code in test.c needs to be compiled with -lm. Then you would compile the module with the command
which generates an object file Test.so. Then when hugs loads Test.hs, it will also load Test.so.
In the standard FFI, each foreign import declaration should name a C header file containing the prototype of the function. Because this is often cumbersome, ffihugs provides the following additional option:
Mark P. Jones et al. Hugs 98 User Manual, June 1999.
Hugs 98 User's Guide (distributed with Hugs).
Paul Hudak & Joseph H. Fasel. A gentle introduction to Haskell. ACM SIGPLAN Notices, 27(5), May 1992.
S. Peyton Jones (editor). Haskell 98 Language and Libraries: The Revised Report. December 2002.
Manuel Chakravarty et al. Haskell 98 Foreign Function Interface 1.0, Addendum to the Haskell Report, September 2003.
Hugs 98: Mark Jones and others, June 1999.
Manual page: Jonathan Bowen, modified by Gary Leavens, and then (with apologies to the original authors) by Mark Jones. Updated for Hugs 98 by Antti-Juhani Kaijanaho and Ross Paterson. Updated for the March 2005 ffihugs changes by Joseph P. Skudlarek.