The Hugs 98 User's Guide | ||
---|---|---|
<<< Previous | Using Hugs | Next >>> |
The Hugs prompt accepts expressions, but not Haskell definitions. These should be placed in text files containing Haskell modules, and these modules loaded into Hugs either by listing them on the command line, or by using the commands listed here. Hugs assumes that each Haskell module is in a separate file. You can load these files by name, or by specifying a module name.
Hugs maintains a notion of a current module, initially the Prelude and normally indicated by the prompt. Expressions presented to Hugs are interpreted within the scope of the current module, i.e. they may refer to unexported names within the module.
:load [file-or-module...]
Clear all files except the Prelude and modules it uses, and then load the specified files or modules (if any). The last module loaded becomes the current module.
You may specify a literal filename. The named file may contain a Haskell module with any name, but you can't load two modules with the same name together. To include a literal space in a filename, either precede it with a backslash or wrap the whole filename double quotes. Double quoted filenames may also contain the escape sequences "\ ", "\"" and "\\". Other bachslashes are interpreted literally.
When asked to load a module M, Hugs looks for a file dir/M.hs or dir/M.lhs, where dir is a directory in its search path. (The "/" is used on Unix systems; Windows systems use "\".) The search path may be changed using the -P option, while the set of suffixes tried may be changed using the -S option (see the Section called Module loading options in the chapter called Changing the behaviour of Hugs). The file found should contain a Haskell module called M.
In mapping compound module names like A.B.C to files, the dots are interpreted as slashes, leading to filenames dir/A/B/C.hs or dir/A/B/C.lhs.
Modules imported by Haskell modules are resolved to filenames in the same way, except that an extra directory is searched first when
the importing module was loaded by specifying a filename in that directory, or
the importing module was found relative to that directory.
This fits nicely with the scenario where you load a module
Prelude> :load /path/to/my/project/code.hs Main> |
:also [file-or-module...]
Read the specified additional files or modules. The last module loaded becomes the current module.
:reload
Clear all files except the Prelude and modules it uses, and then reload all the previously loaded modules.
:module module
Set the current module for evaluating expressions.
:edit [file]
The :edit command starts an editor program to modify or view a Haskell module. Hugs suspends until the editor terminates, and then reloads the currently loaded modules. The -E option (see the Section called Specifying a source file editor in the chapter called Changing the behaviour of Hugs) can be used to configure Hugs to your editor of choice.
If no filename is specified, Hugs edits the current module.
:find name
Edit the module containing the definition of name.
<<< Previous | Home | Next >>> |
Using Hugs | Up | Getting information |