Skip to content

generalise runhaskell to support arbitrary file names, not just those with .{l}hs extensions

The GHC installation should include an executable (either a binary or e.g. /bin/sh script) which can be used at the top of files with the unix "#!" mechanism to create an executable script. Malcolm Wallace points out that runhs from the hmake distribution can be used for this, but it should really be part of GHC.

http://www.haskell.org/pipermail/glasgow-haskell-users/2007-March/012172.html

Now that Simon Marlow (?) has implemented the '-x' option to allow files to use arbitrary extensions, this should be as easy as a 2 or 3 line shell script, although I don't know if runghc recognises -x so maybe there is a bit more work to be done.

I would suggest that the name of the executable be 'runhs-ghc' and that a link should be created called 'runhs' (similar to 'runhaskell'; also included in /etc/alternatives/ in Debian) which can be shared with other compilers/interpreters.

For instance, if runghc recognised -x then the following would work as the contents of runhs-ghc:

#!/bin/sh /path/to/runghc -x hs "$@"

(The /path/to/runghc should point to the runghc which is installed at the same time as the above script is installed, so it will not be as simple as copying the script into place - some variable substitution will be needed - I think this is standard practice, see the 'firefox' script on a Linux distro for an example of such binding)

Thanks,

Frederik

Trac metadata
Trac field Value
Version 6.6
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC Malcolm.Wallace@cs.york.ac.uk, glasgow-haskell-users@haskell.org
Operating system Unknown
Architecture Unknown
Edited by dons
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information