diff --git a/starting_points/elm/.gitignore b/starting_points/elm/.gitignore new file mode 100644 index 0000000..a72d1b2 --- /dev/null +++ b/starting_points/elm/.gitignore @@ -0,0 +1 @@ +elm-stuff/ diff --git a/starting_points/elm/GameOfLife.elm b/starting_points/elm/GameOfLife.elm new file mode 100644 index 0000000..4b2959a --- /dev/null +++ b/starting_points/elm/GameOfLife.elm @@ -0,0 +1,50 @@ +module GameOfLife exposing (..) + +import Html exposing (Html, Attribute, button, div, text, table, tr, td) + + +main = + Html.beginnerProgram + { model = model + , view = view + , update = update + } + + + +-- MODEL + + +type alias Model = + {} + + +model : Model +model = + {} + + + +-- UPDATE + + +type Msg + = Nop + + +update : Msg -> Model -> Model +update msg model = + case msg of + Nop -> + model + + + +-- VIEW + + +view : Model -> Html Msg +view model = + div [] + [ div [] [ text "Conway's Game of Life" ] + ] diff --git a/starting_points/elm/README.md b/starting_points/elm/README.md new file mode 100644 index 0000000..7205ab9 --- /dev/null +++ b/starting_points/elm/README.md @@ -0,0 +1,48 @@ +## ELM Starting Point + +All you ever wanted to know about ELM at http://elm-lang.org/ + +More references +- http://elm-lang.org/docs/syntax +- http://package.elm-lang.org/packages/elm-community/elm-test/latest +- http://package.elm-lang.org/ + +### Installing ELM + +``` +npm install -g elm +npm install -g elm-test +``` +More options at https://guide.elm-lang.org/get_started.html + +### Running and Testing + +Preparing +``` +elm-package install -y +pushd tests && elm-package install -y && popd +``` + +Running tests +``` +elm-test +``` + +Running the application +``` +elm reactor +``` +Then open your favorite browser, probably at http://localhost:8000/ + +### Atom + +``` +apm install language-elm +``` + +You might appreciate code formatting, via https://github.com/avh4/elm-format +``` +apm install elm-format +``` + +More details and options at https://boonofcode.svbtle.com/setting-up-an-atom-elm-dev-environment diff --git a/starting_points/elm/elm-package.json b/starting_points/elm/elm-package.json new file mode 100644 index 0000000..7b151db --- /dev/null +++ b/starting_points/elm/elm-package.json @@ -0,0 +1,16 @@ +{ + "version": "1.0.0", + "summary": "Conway's Game of Life", + "repository": "https://github.com/frawa/coderetreat.git", + "license": "BSD3", + "source-directories": [ + "." + ], + "exposed-modules": [], + "dependencies": { + "elm-community/elm-test": "3.1.0 <= v < 4.0.0", + "elm-lang/core": "5.0.0 <= v < 6.0.0", + "elm-lang/html": "2.0.0 <= v < 3.0.0" + }, + "elm-version": "0.18.0 <= v < 0.19.0" +} diff --git a/starting_points/elm/tests/Main.elm b/starting_points/elm/tests/Main.elm new file mode 100644 index 0000000..8b7862b --- /dev/null +++ b/starting_points/elm/tests/Main.elm @@ -0,0 +1,13 @@ +port module Main exposing (..) + +import Tests +import Test.Runner.Node exposing (run) +import Json.Encode exposing (Value) + + +main : Test.Runner.Node.TestProgram +main = + run emit Tests.all + + +port emit : ( String, Value ) -> Cmd msg diff --git a/starting_points/elm/tests/Tests.elm b/starting_points/elm/tests/Tests.elm new file mode 100644 index 0000000..b71e49c --- /dev/null +++ b/starting_points/elm/tests/Tests.elm @@ -0,0 +1,14 @@ +module Tests exposing (..) + +import Test exposing (..) +import Expect +import GameOfLife exposing (..) + + +all : Test +all = + describe "Let's get going" + [ test "red" <| + \() -> + Expect.equal True False + ] diff --git a/starting_points/elm/tests/elm-package.json b/starting_points/elm/tests/elm-package.json new file mode 100644 index 0000000..5e62120 --- /dev/null +++ b/starting_points/elm/tests/elm-package.json @@ -0,0 +1,18 @@ +{ + "version": "1.0.0", + "summary": "Test Conway's Game of Live", + "repository": "https://github.com/frawa/coderetreat.git", + "license": "BSD3", + "source-directories": [ + ".", + ".." + ], + "exposed-modules": [], + "dependencies": { + "elm-lang/core": "4.0.0 <= v < 5.0.0", + "elm-lang/html": "1.1.0 <= v < 2.0.0", + "elm-community/elm-test": "2.0.0 <= v < 3.0.0", + "rtfeldman/node-test-runner": "2.0.0 <= v < 3.0.0" + }, + "elm-version": "0.17.0 <= v < 0.18.0" +}