MyNixOS website logo
Description

Haskell CLI framework.

Haskell CLI framework. See README.md for more details.

iris

GitHub CI Hackage MPL-2.0 license

Iris is a Haskell framework for building CLI applications that follow Command Line Interface Guidelines.

🌈 Iris (/ˈaɪrɪs/) is a Greek goddess associated with communication, messages, the rainbow, and new endeavors.

Iris changing her workflow and hair colour depending on the time of day.

ℹ️ DISCLAIMER #1: Currently, Iris is in experimental phase and mostly for early adopters. It may lack documentation or have significant breaking changes. We appreciate anyone's help in improving the documentation! At the same time, the maintainers will strive to provide helpful migration guides.

ℹ️ DISCLAIMER #2: Iris is developed and maintained in free time by volunteers. The development may continue for decades or may stop tomorrow. You can use GitHub Sponsorship to support the development of this project.

Goals

Iris development is guided by the following principles:

  1. Support Command Line Interface Guidelines. Features or changes that violate these guidelines are not accepted in the project.

  2. Beginner-friendliness. Haskell beginners should be able to build CLI applications with Iris. Hence, the implementation of Iris API that uses less fancy Haskell features are preferred. When the complexity is justified, the cost of introducing this extra complexity should be mitigated by having better documentation.

  3. Reasonable batteries-included. Iris is not trying to be minimalistic as possible, it strives to provide out-of-the-box solutions for most common problems. But at the same time, we don't want to impose unnecessary heavy dependencies.

  4. Excellent documentation. Iris documentation should be as helpful as possible in using the framework.

    NOTE: Currently, Iris may lack documentation but there's an ongoing effort to improve the situation.

  5. Single-line access. Iris is designed for qualified imports, and you should be able to get all the needed API by writing a single import line:

    import qualified Iris
    

🧱 Iris focuses solely on CLI applications. If you're interested in building TUI app with Haskell, check out brick.

Features

CLI apps built with Iris offer the following features for end users:

  • Automatic detection of colouring support in the terminal
  • Ability to check required external tools if you need e.g. curl or git
  • Support for standard CLI options out-of-the-box:
    • --help
    • --version
    • --numeric-version: helpful for detecting required tools versions
    • --no-input: for disabling all interactive features
    • --colour=(auto|never|always): to set colour mode
    • --no-colour: to disable terminal colouring
  • Utilities to open files in a browser

Quick Start Guide

📚 Refer to the complete Iris tutorial for more details and examples of more Iris features.

iris is compatible with the following GHC versions - supported versions

In order to start using iris in your project, you will need to set it up with these steps:

  1. Add the dependency on iris in your project's .cabal file. For this, you should modify the build-depends section according to the below section:

    build-depends:
      , base ^>= LATEST_SUPPORTED_BASE
      , iris ^>= LATEST_VERSION
    
  2. To use this package, refer to the below example.

    {-# LANGUAGE DerivingStrategies #-}
    {-# LANGUAGE GeneralizedNewtypeDeriving #-}
    
    module Main (main) where
    
    import Control.Monad.IO.Class (MonadIO (..))
    
    import qualified Iris
    
    
    newtype App a = App
        { unApp :: Iris.CliApp () () a
        } deriving newtype
            ( Functor
            , Applicative
            , Monad
            , MonadIO
            )
    
    appSettings :: Iris.CliEnvSettings () ()
    appSettings = Iris.defaultCliEnvSettings
        { Iris.cliEnvSettingsHeaderDesc = "Iris usage example"
        , Iris.cliEnvSettingsProgDesc = "A simple 'Hello, world!' utility"
        }
    
    app :: App ()
    app = liftIO $ putStrLn "Hello, world!"
    
    main :: IO ()
    main = Iris.runCliApp appSettings $ unApp app
    

For contributors

Check CONTRIBUTING.md for contributing guidelines.

Development

To build the project and run the tests locally, you can use either cabal or stack.

See the First time section if you don't have Haskell development environment locally.

Cabal

Build the project:

cabal build all

Run all unit tests:

cabal test --enable-tests --test-show-details=direct

Stack

Build the project:

stack build --test --no-run-tests

Run all unit tests:

stack test

First time

If this is your first time dealing with Haskell tooling, we recommend using GHCup.

During the installation, GHCup will suggest you installing all the necessary tools. If you have GHCup installed but miss some of the tooling for some reason, type the following commands in the terminal:

ghcup install ghc 9.2.5
ghcup set     ghc 9.2.5
ghcup install cabal 3.8.1.0

If you are using Linux or macOS, you may find ghcup tui command a more attractive option.

Metadata

Version

0.1.0.0

License

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