| The Hugs 98 User's Guide | ||
|---|---|---|
| Prev | ||
The interpreter may be started with a command line of the form
hugs [option] [file]
On many systems it can also be found in the system menus, and may be started by (double) clicking on a file with a ".hs" or ".lhs" extension.Hugs takes options from the command line and elsewhere (see ), and then loads the Haskell Prelude module, as well as as any modules specified on the command line.
Hugs starts with a banner like
__ __ __ __ ____ ___ _________________________________________ || || || || || || ||__ Hugs 98: Based on the Haskell 98 standard ||___|| ||__|| ||__|| __|| Copyright (c) 1994-2005 ||---|| ___|| World Wide Web: http://haskell.org/hugs || || Report bugs to: hugs-bugs@haskell.org || || Version: March 2005 _________________________________________ Haskell 98 mode: Restart with command line option -98 to enable extensions Type :? for help Hugs.Base>The prompt string Hugs.Base> indicates that the current module is an empty module called Hugs.Base (assuming no modules were specified on the command line). At this prompt, you can type Haskell expressions to be evaluated, and also enter commands of the form ":cmd", where cmd may be abbreviated to a single letter.
[expr]
Evaluate a Haskell expression.
The expression cannot be broken over multiple lines.
Usually, the value is simply converted to a string
(using show) and printed:
Hugs.Base> 1+2 3The printing style can be changed with the
-u option
(see ).
However, if expr has type IO t for some type t, the resulting IO action is performed:
Hugs.Base> print (1+2) >> putStrLn "bye" 3 byeUsually the value produced by this action is ignored, but this can be changed with the
+I option
(see ).
On ambiguous types: If the type of expr is ambiguous, defaulting is applied to each ambiguous type variable v whose constraints all have the form C v where C is a standard class, and at least one of these classes is a numeric class, or is Show, Eq or Ord. (This is an extension of the Haskell 98 rule applied to top-level definitions in modules, which requires a numeric class.) It is an error if any ambiguous type variables cannot be handled in this way. For example, consider
Hugs.Base> reverse [] []Here a Show constraint on the list elements arises from Hugs's use ofshowto display the result, so the type of the elements defaults to Integer, removing the ambiguity.
:type []