This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
Reading and writing from the console in Node
version 1.1.1
license BSD3
native-modules True
elm-version 0.15.0 <= v < 0.17.0
Tag 1.1.1
Committed At 2016-03-21 15:30:01 UTC
elm-lang/core 2.0.0 <= v < 4.0.0 3.0.0



Elm Console Build Status

This library allows reading and writing from the console in Node. It is a replacement for maxsnew/IO, which is no longer updated.


An elm Program:

module Main where

import Console 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!

Design and Implementation

The implementation is based on the IOSpec haskell library.