Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/laszlopandy/elm-console
Elm library to read and write to the console in Node.
https://github.com/laszlopandy/elm-console
Last synced: about 2 months ago
JSON representation
Elm library to read and write to the console in Node.
- Host: GitHub
- URL: https://github.com/laszlopandy/elm-console
- Owner: laszlopandy
- License: bsd-3-clause
- Fork: true (maxsnew/IO)
- Created: 2015-06-19T10:52:57.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-03-21T15:31:01.000Z (over 8 years ago)
- Last Synced: 2024-04-09T17:22:31.367Z (3 months ago)
- Language: Elm
- Homepage:
- Size: 153 KB
- Stars: 55
- Watchers: 6
- Forks: 16
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- Awesome-BigData - elm-console - Elm library to read and write to the console in Node. (Libraries)
README
Elm Console [![Build Status](https://travis-ci.org/laszlopandy/elm-console.png?branch=master)](https://travis-ci.org/laszlopandy/elm-console)
=========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:
```elm
module Main whereimport Console exposing (IO, (>>>), (>>=), forever, getLine, pure, exit, putStrLn)
import Taskimport List
import Maybe
import Stringecho : 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 0port 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!
```Design and Implementation
-------------------------
The implementation is based on the
[IOSpec](http://hackage.haskell.org/package/IOSpec) haskell library.