On Unix systems, executable programs may be created by
placing runhugs in the first line of an executable file, like so:
> module Main where
> main = putStr "Hello, World\n"
Because runHugs uses literate Haskell only, the line starting with #! is viewed as a comment. Stand-alone programs can import other modules using import chasing---these modules need not be literate. The runhugs program uses the same environment variables to set Hugs options as the standard Hugs systems. However, runhugs does not set options from the command line; all command line options are passed into the executing Hugs program. The stand-alone Hugs program may return an exit code.
On Windows 95/NT, runhugs is invoked using a separate file extension that is set up to call runhugs rather than hugs. Installation sets up the .hsx extension for this purpose. A .hsx program will run when it is clicked on; a console window will appear if the program writes to standard output or reads from standard input. This window is closed immedately upon exiting the program. There is no way to pass parameters to the .hsx program when it is double-clicked. Windows 95/NT can also use runhugs to open files of a given type; this involves setting the "open" command for the file type to call runhugs, passing it the Haskell program to run and the file being opened. The online documentation has some examples of this.
The Hugs for Windows front-end is useful for beginners, but is not compatible with the Win32 libraries or with programs that use them, such as Conal Elliot's Fran system or Paul Hudak's Graphics library. In addition, the current implementation uses a compute-intensive polling process to detect certain events, and this can incur a fairly substantial performance penalty. For these reasons, the Hugs for Windows front-end is not recommended for work on large projects.