MyNixOS website logo
Description

Stack wrapper for single-file Haskell programs.

Stack wrapper for single-file Haskell programs. Declare package dependencies in the source code of your single-file Haskell program. Easily and reliably run your program, compile it, or load it in GHCi or Ghcid.

runhs

Stack wrapper for single-file Haskell programs.

Declare package dependencies in the source code of your single-file Haskell program. Easily and reliably run your program, compile it, or load it in GHCi or Ghcid.

Install

  1. First, install Stack.

  2. Add Stack's install directory to your PATH.

  • Windows: Installing Stack automatically adds its install directory to your PATH.

  • Most Linux:echo 'export PATH="${HOME}/.local/bin:${PATH}"' >> ~/.profile && export PATH="${HOME}/.local/bin:${PATH}"

  • MacOS Pre-Catalina:echo 'export PATH="${HOME}/.local/bin:${PATH}"' >> ~/.bash_profile && export PATH="${HOME}/.local/bin:${PATH}"

  • MacOS Catalina and newer:echo 'export PATH="${HOME}/.local/bin:${PATH}"' >> ~/.zshrc && export PATH="${HOME}/.local/bin:${PATH}"

  1. Finally, use one of the following install methods.
  • Stack (recommended):stack install runhs

  • Download: Download the appropriate executable for your platform from the Releases page, unzip it, and put it somewhere on your PATH.

Usage

Add a block comment (the front matter) at the start of any single-file Haskell program in the following format:

{-
resolver: lts-16.6
packages:
  - bytestring
  - containers
-}

The front matter must be the first block comment in your file, and the comment delimiters {- and -} must appear on their own lines, just as above.

The resolver property is required and must be a valid Stackage resolver. The packages property is required if your Haskell program depends on external packages, but may be omitted if your Haskell program does not.

Once you have the appropriate front matter at the top of your file, you may load your program in Watch Mode or in Interactive Mode (a.k.a. REPL Mode) in GHCi, or run your program as a script, or compile your program, using the following command format.

runhs (watch|repl|script|compile) <file> [<args>]

Copyright and License

Copyright (C) 2020-2021 Daniel Brice

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of Daniel Brice nor the names of other contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Metadata

Version

1.0.0.9

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows