This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
Terminal-based IO Side Effects
version 1.0.1
license BSD3
native-modules True
elm-version 0.15.0 <= v < 0.16.0
Tag 2.0.0
Committed At 2015-09-14 16:25:51 UTC
elm-lang/core 2.0.0 <= v < 3.0.0 2.1.0



IO in Elm Build Status

This repo provides a library for writing console-based programs in Elm.


An elm Program:

module Main where

import IO exposing (IO, (>>>), (>>=), forever, getLine, pure, exit, putStrLn)
import Task

import List
import Maybe
import String

echo : IO ()
echo = forever (getLine >>= putStrLn)

loop : IO ()
loop = getLine >>= \s ->
       if s == "exit"
       then pure ()
       else putStrLn s >>> loop
hello : IO ()
hello = putStrLn "Hello, Console!" >>>
        putStrLn "I'll echo your input until you say \"exit\":" >>>
        loop >>>
        putStrLn "That's all, folks!" >>>
        exit 0

port runner : Signal (Task.Task x ())
port runner = hello

link in some javascript and then run:

$ elm-make --yes test/Test.elm raw-test.js
$ ./ raw-test.js test.js
$ node test.js
Hello, Console!
I'll echo your input:
That's all, folks!

Command Line Interface

The basic interface is infile outfile, where infile is a compiled Elm file with requests and response signals set up as above and outfile is the desired filename for the compiled output.

Design and Implementation

The implementation is based on the IOSpec haskell library.