Hugs


Hugs, also Hugs 98, is a bytecode interpreter for the functional programming language Haskell. Hugs is the successor to Gofer, and was originally derived from Gofer version 2.30b. Hugs and Gofer were originally developed by Mark P. Jones, now a professor at Portland State University.
Hugs comes with a simple graphics library. As a complete Haskell implementation that is portable and simple to install, Hugs is sometimes recommended for new Haskell users.
Hugs deviates from the Haskell 98 specification in several minor ways. For example, Hugs does not support mutually recursive modules. A list of differences exists.
The Hugs prompt accepts expressions for evaluation, but not module, type or function definitions. Hugs can load Haskell modules at start-up.

Examples

Extensible records

An example of "Typed records with extensibility", a non standard feature unique to Hugs.

module Main where
import Hugs.Trex
type Coord = Double
type Point2D = Rec
type Point3D = Rec
point2D = :: Point2D
-- emptyRec :: Rec EmptyRow -- predefined
-- -- rec. extension
-- -- record value decomposition, pattern fields must be non empty
-- -- record type decomposition
-- in the context means rec does not contain field z
-- add a field z with the same type as field x
addZCoord :: => t -> Rec -> Rec
addZCoord z =
point3D = addZCoord 3 point2D -- :: Point3D
-- admit any record with showable fields x and y
printXY :: => Rec -> IO
printXY point = putStrLn xy
-- with SML style field accessors
where xy = show ++", "++ show
incrementX :: => Rec -> Rec
incrementX =
main = do
let point3D' = incrementX point3D
printXY point2D
printXY point3D'

Running with H98 compatibility turned off to activate language extensions:

runhugs -98 test.hs