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
    Phaser
    Phaser
    Phaser is a fast, free, and fun open
    source HTML5 game framework that offers
    WebGL and Canvas rendering across
    desktop and mobile web browsers. Games
    can be co...
    Download Phaser
  • 2
    VASSAL Engine
    VASSAL Engine
    VASSAL is a game engine for creating
    electronic versions of traditional board
    and card games. It provides support for
    game piece rendering and interaction,
    and...
    Download VASSAL Engine
  • 3
    OpenPDF - Fork of iText
    OpenPDF - Fork of iText
    OpenPDF is a Java library for creating
    and editing PDF files with a LGPL and
    MPL open source license. OpenPDF is the
    LGPL/MPL open source successor of iText,
    a...
    Download OpenPDF - Fork of iText
  • 4
    SAGA GIS
    SAGA GIS
    SAGA - System for Automated
    Geoscientific Analyses - is a Geographic
    Information System (GIS) software with
    immense capabilities for geodata
    processing and ana...
    Download SAGA GIS
  • 5
    Toolbox for Java/JTOpen
    Toolbox for Java/JTOpen
    The IBM Toolbox for Java / JTOpen is a
    library of Java classes supporting the
    client/server and internet programming
    models to a system running OS/400,
    i5/OS, o...
    Download Toolbox for Java/JTOpen
  • 6
    D3.js
    D3.js
    D3.js (or D3 for Data-Driven Documents)
    is a JavaScript library that allows you
    to produce dynamic, interactive data
    visualizations in web browsers. With D3
    you...
    Download D3.js
  • More »

Linux commands

  • 1
    abidiff
    abidiff
    abidiff - compare ABIs of ELF files
    abidiff compares the Application Binary
    Interfaces (ABI) of two shared libraries
    in ELF format. It emits a meaningful
    repor...
    Run abidiff
  • 2
    abidw
    abidw
    abidw - serialize the ABI of an ELF
    file abidw reads a shared library in ELF
    format and emits an XML representation
    of its ABI to standard output. The
    emitted ...
    Run abidw
  • 3
    copac2xml
    copac2xml
    bibutils - bibliography conversion
    utilities ...
    Run copac2xml
  • 4
    copt
    copt
    copt - peephole optimizer SYSNOPIS:
    copt file.. DESCRIPTION: copt is a
    general-purpose peephole optimizer. It
    reads code from its standard input and
    writes an ...
    Run copt
  • 5
    gather_stx_titles
    gather_stx_titles
    gather_stx_titles - gather title
    declarations from Stx documents ...
    Run gather_stx_titles
  • 6
    gatling-bench
    gatling-bench
    bench - http benchmark ...
    Run gatling-bench
  • More »

Ad