This project is an attempt to simplify writing simple tools and CLI scripts in pure Elm by allowing you to write monadic IO programs instead of using Platform.worker, ports and The Elm Architecture.
I am curious if anyone finds this useful and would like to give some feedback on the ideas outlined in the readme or the API specified the package docs. At this point, this is mostly a proof of concept but it works.
Alas, doesn’t currently work on Mac OS. (Error log below). But this is fascinating idea. Anxious to try it out again later.
➜ elm npm install -g albertdahlin/elm-posix
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /Users/carlson/.npm/_cacache/tmp/git-clone-8c226782/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/Users/carlson/.npm/_cacache/tmp/git-clone-8c226782/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/carlson/.npm/_logs/2021-07-13T22_43_55_479Z-debug.log
Love it! Will use it for my next script. For readability and understandability it would be nice though if it could be prevented to have these <| \_ -> in there.
Yes, I got it to install today (Yay!). But now I get the below. (I copies your HelloUser example).
➜ posix elm-cli make src/HelloUser.elm dest/helloUser.js
-- TYPE MISMATCH - /var/folders/ml/vl09g4313rb1jd6y9zvcd6200000gn/T/elm-cli-2643.elm
The 1st argument to `program` is not what I expect:
20| IO.program Cli.program recv send
^^^^^^^^^^^
This `program` value is a:
IO.PosixProgram
But `program` needs the 1st argument to be:
IO.Process -> IO.IO ()
@Donn it looks like elm-cli node application acts as a little platform for running Process -> IO () elm functions. I think it’s taking the compiled elm code and then elm-cli sets up the ports to talk to node.