Skip to content

Instantly share code, notes, and snippets.

@jaketrent
Created March 20, 2017 13:47
Show Gist options
  • Save jaketrent/df13653b7471bc63bdb5f1f32ad04c81 to your computer and use it in GitHub Desktop.
Save jaketrent/df13653b7471bc63bdb5f1f32ad04c81 to your computer and use it in GitHub Desktop.
A headless Elm program
module Main exposing (..)
import MyProgram exposing (print)
import Platform exposing (program)
nodeProgram : a -> Program Never () ()
nodeProgram _ =
program
{ init = ( (), Cmd.none )
, update = \() -> \() -> ( (), Cmd.none )
, subscriptions = \() -> Sub.none
}
main : Program Never () ()
main =
nodeProgram (print 9)
module MyProgram exposing (..)
print : Int -> Int
print num =
Debug.log "num of destiny" num
elm make --output main.js *.elm
node main.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment