EnglishFrenchSpanish

Ad


OnWorks favicon

hugs - Online in the Cloud

Run hugs in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command hugs that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

PROGRAM:

NAME


hugs, runhugs, ffihugs - Hugs 98, functional programming system

SYNOPSIS


hugs [ options ] [ modules ]
runhugs [ options ] module [ args ]
ffihugs [ options ] module [ compiler_argument ] ...

DESCRIPTION


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.

OPTIONS


Some options are toggled with + or - to turn them on or off, respectively.

Language conformance
+98 Accept only Haskell 98 (cannot be changed within Hugs; default: on). Turning this
off enables several special Hugs extensions, which are described in the Hugs 98
User Manual.

+o Allow overlapping instances (a Hugs extension; default: off)

+O Allow unsafe overlapping instances (a Hugs extension; default: off)

+H Allow `here documents' (a Hugs extension; default: off)

Module loading
+l Treat files whose names end in neither `.hs' nor `.lhs' as literate scripts
(default: off)

+. Print dots to show progress while loading modules (default: off)

+q Print nothing to show progress while loading modules (default: on)

+w Always show which files are loaded (default: off)

Expression evaluation
+s Print number of reductions/cells after each evaluation (default: off)

+t Print type after each evaluation (default: off)

+T Apply the Haskell defaulting rules before printing types (default: off)

+g Print number of cells recovered after each garbage collection (default: off)

+Q Qualify names when printing (default: off)

+k Show kind errors in full (default: off)

+u Use "show" to display results (default: on)

+I Display results of IO programs (default: off)

Parameters
Other options (in which - could be replaced by +, the choice making no difference) are:

-hnum Set heap size (cannot be changed within Hugs; default: 250K)

-pstr Set prompt string to str (default: `%s> '). Any %s in the prompt will be replaced
by the current module name.

-rstr Set repeat last expression string to str (default: $$).

-Pstr Set search path for source files to str, which should be a colon-separated list of
directories. A null entry in this list will be replaced by the previous search
path; a null str means the default path. Any occurrence of {Hugs} in this string
is expanded to the Hugs library directory, namely /usr/lib/hugs. Similarly, {Home}
is expanded to your home directory (the value of the HOME environment variable).
An entry of the form `directory/*' means all the immediate subdirectories of
directory. The default value is

.:{Home}/lib/hugs/packages/*:/usr/local/lib/hugs/packages/*:{Hugs}/packages/*:{Hugs}/libraries

-Sstr Set the colon-separated list of source file suffixes to str (default: .hs:.lhs). A
null entry in this list will be replaced by the previous suffix list; a null str
means the default list.

-Estr Use editor setting given by str (default: the value of the EDITOR environment
variable). Any occurrences of %d and %s in the editor option are replaced by the
start line number and the name of the file to be edited, respectively. A common
setting is "vi +%d %s".

-cnum Set constraint cutoff limit in the type checker to num (default: 40).

-Fcmd Set preprocessor filter for source files to cmd (unset by default). Instead of
reading a source file directly, Hugs will read the standard output of cmd run with
the source file name as argument.

-Xstr The string str is interpreted as an option string. This is useful, for example,
for passing multiple arguments to runhugs in a #! script.

COMMANDS


Once the interpreter has been loaded, the following commands are available:

:load [modules] clear all modules except the prelude, and load the specified modules.

:also modules read additional modules.

:reload repeat last load command.

:edit file edit file.

:edit edit last file.

:module module set module for evaluating expressions.

expr evaluate expression.

:type expr print type of expression.

:? display this list of commands.

:set options set command line options.

:set help on command line options.

:names [patterns] list names currently in scope matching any of the shell-style patterns.

:info names describe named objects.

:browse modules browse names exported by modules.

:find name edit file containing definition of name.

:!command shell escape.

:cd dir change directory.

:gc force garbage collection.

:version print Hugs version.

:quit exit Hugs interpreter.

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.

STANDALONE PROGRAMS


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.

C INTERFACE


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

ffihugs Test.hs test.c -lm

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:

-istr Specify an include for the generated C file. The include string should be
something that can follow "#include" in a C program, as in

ffihugs '-i<math.h>' '-i"mydefs.h"' Test.hs test.c -lm

ENVIRONMENT


HUGSFLAGS
Additional options for hugs, processed before any given on the command line.

HUGSDIR
The Hugs library directory (default: /usr/lib/hugs).

EDITOR The default editor, if -E is not given.

SHELL Used to specify the shell that is invoked by the :! command.

Use hugs online using onworks.net services


Free Servers & Workstations

Download Windows & Linux apps

  • 1
    Sardi
    Sardi
    Sardi is a complete restyling and
    optimisation of svg code. 6 choices for
    your applications and 10 kind of folders
    to use in your file manager. The sardi
    icons...
    Download Sardi
  • 2
    LMMS Digital Audio Workstation
    LMMS Digital Audio Workstation
    LMMS is a free cross-platform software
    which allows you to produce music with
    your computer. If you like this project
    consider getting involved in the project
    h...
    Download LMMS Digital Audio Workstation
  • 3
    FreeRTOS Real Time Kernel (RTOS)
    FreeRTOS Real Time Kernel (RTOS)
    FreeRTOS is a market-leading real-time
    operating system (RTOS) for
    microcontrollers and small
    microprocessors. Distributed freely
    under the MIT open source lice...
    Download FreeRTOS Real Time Kernel (RTOS)
  • 4
    Avogadro
    Avogadro
    Avogadro is an advanced molecular
    editor designed for cross-platform use
    in computational chemistry, molecular
    modeling, bioinformatics, materials
    science and ...
    Download Avogadro
  • 5
    XMLTV
    XMLTV
    XMLTV is a set of programs to process
    TV (tvguide) listings and help manage
    your TV viewing, storing listings in an
    XML-based format. There are utilities to
    do...
    Download XMLTV
  • 6
    strikr
    strikr
    Strikr Free Software project. Artifacts
    released under a 'intent based'
    dual license: AGPLv3 (community) and
    CC-BY-NC-ND 4.0 international
    (commercial)...
    Download strikr
  • More »

Linux commands

Ad