# elm-run

> Task-based bindings for running Elm in the console.

Latest version **0.0.3** (published 2017-06-25) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install elm-run
pnpm add elm-run
yarn add elm-run
bun add elm-run
```

Provides the command `elm-run`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2017-06-25 |
| First published | 2016-10-01 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.0.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Kofi Gumbs |
| Maintainers | hkgumbs |
| Keywords | cli, console, elm, elm-run, io, script |

## Links

- npm: https://www.npmjs.com/package/elm-run
- Repository: https://github.com/hkgumbs/elm-run
- Issues: https://github.com/hkgumbs/elm-run/issues/new
- npm.io page: https://npm.io/package/elm-run

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2017-06-25
- 0.0.2 — 2016-10-01
- 0.0.1 — 2016-10-01

## README

# `elm run`

> **NOTE:** not upgraded for 0.18 - I've since concluded that ports are a better way to do this in Elm.
> `elm-test` is a great example of a node-based Elm app that uses ports to guarantee safety.

`Task`-based bindings for running Elm in the console.

> Inspired by [elm-console](https://github.com/laszlopandy/elm-console)
> > Inspired by [IO](https://github.com/maxsnew/IO)
> > > Inspired by [IOSpec](http://hackage.haskell.org/package/IOSpec)


## Usage

Here's an interactive "Hello, World!" example:

```elm
import Run
import Stream.Writable as Run
import Stream.Readable as Run
import Task



type Model = Model

type Msg
    = Name String
    | Abort



(>>=) = Task.andThen


read : Cmd Msg
read =
    Run.stdin >>= Run.getLine
        |> Task.perform (always Abort) Name


write : String -> Cmd Msg
write name =
    Run.stdout >>= Run.putStrLn ("Hello, " ++ name ++ "!")
        |> Task.perform (always Abort) (always Abort)



init : ( Model, Cmd Msg )
init =
    ( Model, read )


update : Msg -> Model -> ( Model, Cmd Msg )
update msg _ =
    case msg of
        Name name ->
            ( Model, write name )

        Abort ->
            ( Model, Cmd.none )



main : Program Never
main =
    Run.program { init = init , update = update }
```

`elm run` operates on compiled elm files,
which means the workflow looks something like this:

```
$ elm make --output main.js Main.elm
$ elm run main.js
World
Hello, World!
```

You can get the `elm run` command via NPM:

```
npm install -g elm-run
```

Your program ends once it is no longer waiting for `Task`s to complete.


## Tests

```
docker build -t elm-run .
docker run elm-run ./test/run-all.sh
```

---
_Source: https://npm.io/package/elm-run · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
