Haskell for Plan 9


News:I've just discovered that hugs works fine with acme (:e command) -- just start hugs with the -Eacme option. It probably would work fine with sam too.
I have also modified hugs to install the libraries and binaries in $home/lib/hugs and $home/bin/$objtype respectively. Do a make install and you'll get a hugs installation that works everywhere. To play with haskell demoes go to $home/lib/hugs/demos.
This is a Plan 9 port of the Haskell functional language interpreter Hugs. More information about the language Haskell (including hugs documentation and haskell tutorials) could be found here.

This port does not appear to lack any functionality from the original hugs interpreter. Only the readlib library does not exist and you'll have to use the normal plan9 mouse-driven copy/paste to edit while in Hugs.

Plan9-related files are located in src/Plan9 and consist of: Makefile, config.h and options.h.. Those files have conveniently been copied for you in the src/ directory so the only thing that you need to do is to type 'make'.

The port is non-desctructive in the sense that I've worked around the Hugs source. The only major changes are:
  • #ifdef-ed around a few function definitions in machdep.c which the compiler didn't like
  • #ifdef-ed around a 'getch()' call in machdep.c -- doesn't exist in plan9
  • removed a few //-style comments that made no sense anyway :)

    Drawbacks: Hugs is currently not configured to use an editor (:e will not work). I can change that in the future if anyone is interested. Hugs also has no "make install" and currently runs only from the directory it was compiled in. To change this behaviour you can start hugs with -P/something/lib where 'something' is where you put the standard prelude libraries. This could also be changed if enough people are interested.
    Oh, I just realized that the version string is not printed on startup.. Well, it's November 2002 for those who care :)

    Download: here

    Compile: Should be as simple as:
        % gunzip < hugs-p9.tgz | tar xv # no lnfs required -- it's safe there
        % cd hugs-p9/src
        % ape/psh
        $ make
    
    Example:
    cpu% cd hugs-p9
    cpu% cd src
    cpu% ape/psh
    $ make
    cc -c -g -O -DHUGSDIR=\"/usr/andrey/lib/hugs\"  hugs.c
    cc -c -g -O -DHUGSDIR=\"/usr/andrey/lib/hugs\"  storage.c
    cpp: storage.c:2757 Unknown preprocessor control warning
    cc -c -g -O -DHUGSDIR=\"/usr/andrey/lib/hugs\"  input.c
    cc -c -g -O -DHUGSDIR=\"/usr/andrey/lib/hugs\" static.c
    cc -c -g -O -DHUGSDIR=\"/usr/andrey/lib/hugs\"  type.c
    cc -c -g -O -DHUGSDIR=\"/usr/andrey/lib/hugs\"  subst.c
    cc -c -g -O -DHUGSDIR=\"/usr/andrey/lib/hugs\" compiler.c
    cc -c -g -O -DHUGSDIR=\"/usr/andrey/lib/hugs\"  plugin.c
    cc -c -g -O -DHUGSDIR=\"/usr/andrey/lib/hugs\"  builtin.c
    cc -c -g -O -DHUGSDIR=\"/usr/andrey/lib/hugs\"  machine.c
    cc -c -g -O -DHUGSDIR=\"/usr/andrey/lib/hugs\"  output.c
    cc -c -g -O -DHUGSDIR=\"/usr/andrey/lib/hugs\"  ffi.c
    cc -c -g -O -DHUGSDIR=\"/usr/andrey/lib/hugs\"  version.c
    cc  -o hugs hugs.o storage.o input.o static.o type.o subst.o compiler.o  plugin.o builtin.o machine.o output.o ffi.o version.o 
    cc -c -g -O -DHUGSDIR=\"/usr/andrey/lib/hugs\"  runhugs.c
    cc -c -g -O -DHUGSDIR=\"/usr/andrey/lib/hugs\"  server.c
    cc  -o runhugs runhugs.o server.o storage.o input.o static.o type.o subst.o compiler.o  plugin.o builtin.o machine.o output.o ffi.o version.o   
    $ make install
    test -d /usr/andrey/lib/hugs || mkdir /usr/andrey/lib/hugs
    test -d /usr/andrey/lib/hugs/lib || mkdir /usr/andrey/lib/hugs/lib
    test -d /usr/andrey/lib/hugs/demos || mkdir /usr/andrey/lib/hugs/demos
    test -d /usr/andrey/lib/hugs/demos/prolog || mkdir /usr/andrey/lib/hugs/demos/prolog
    test -d /usr/andrey/lib/hugs/lib/hugs || mkdir /usr/andrey/lib/hugs/lib/hugs
    test -d /usr/andrey/lib/hugs/lib/exts || mkdir /usr/andrey/lib/hugs/lib/exts
    cp ../lib/[A-Z]* /usr/andrey/lib/hugs/lib
    cp ../lib/hugs/* /usr/andrey/lib/hugs/lib/hugs/
    cp ../lib/exts/* /usr/andrey/lib/hugs/lib/exts/
    cp ../demos/prolog/* /usr/andrey/lib/hugs/demos/prolog/
    cp ../demos/[A-Z]* /usr/andrey/lib/hugs/demos/
    cp hugs /usr/andrey/bin/386/
    cp runhugs /usr/andrey/bin/386/
    $ 
    __   __ __  __  ____   ___      _________________________________________
    ||   || ||  || ||  || ||__      Hugs 98: Based on the Haskell 98 standard
    ||___|| ||__|| ||__||  __||     Copyright (c) 1994-2002
    ||---||         ___||           World Wide Web: http://haskell.org/hugs
    ||   ||                         Report bugs to: hugs-bugs@haskell.org
    ||   || Version:      _________________________________________
    
    Haskell 98 mode: Restart with command line option -98 to enable extensions
    
    Reading file "../lib/Prelude.hs":
    
    Hugs session for:
    ../lib/Prelude.hs
    Type :? for help
    Prelude> [1..10]
    [1,2,3,4,5,6,7,8,9,10]
    Prelude> map (*3) [1..10]
    [3,6,9,12,15,18,21,24,27,30]
    Prelude> foldr1 (*) [1..100]
    93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
    Prelude> [Leaving Hugs]
    $ 
    
    

    Last Modified: Apr 21 2003
    mirtchovski at gmail