Skip to content
This repository has been archived by the owner on Dec 11, 2018. It is now read-only.
/ elm-console Public archive
forked from laszlopandy/elm-console

Elm library to read and write to the console in Node.

License

Notifications You must be signed in to change notification settings

libreirc/elm-console

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Example

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 = Console.run hello

link in some javascript and then run:

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

How to contribute

Please fork this repo and send Pull Requests!

# Install dependencies including Elm runtime
yarn
# Perform tests
yarn test

# Open Elm REPL
yarn elm-repl
# Generator documentation.json
yarn elm-make -- --docs documentation.json

Design and Implementation

The implementation is based on the IOSpec haskell library.



BSD 3-Clause License

About

Elm library to read and write to the console in Node.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Elm 76.0%
  • JavaScript 17.9%
  • Shell 6.1%