1.1.0 • Published 1 year ago

elm-line v1.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

elm-line

A simple wrapper for Elm that takes Elm scripts and runs them as a command line program.

Want this program in your path? npm link!

Example Usage

$ cat square.ielm
main = Interact.onInts (\x -> x * x)

$ elm-line square.ielm
> 15
225
> 532
283024
> ^C

$ cat tac.ielm
-- a simple program which reverses each line
-- !woem --
main = Interact.onLines String.reverse

$ elm-line tac.ielm <tac.ielm
enil hcae sesrever hcihw margorp elpmis a --
-- meow! --
esrever.gnirtS seniLno.tcaretnI = niam

$ cat paren-words.ielm
onWords : (String -> String) -> Interact.Interactor
onWords fn =
  Interact.onLines (String.split " " >> List.map fn >> String.join " ")
main = onWords (\word -> "(" ++ word ++ ")")

$ elm-line paren-words.ielm
> hello there
(hello) (there)
> what is a word
(what) (is) (a) (word)
> ^C
1.1.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago