{"id":15626752,"url":"https://github.com/bbqbaron/mse","last_synced_at":"2025-03-29T17:25:15.064Z","repository":{"id":90313985,"uuid":"38718538","full_name":"bbqbaron/MSE","owner":"bbqbaron","description":"Bare-bones Minesweeper in Elm","archived":false,"fork":false,"pushed_at":"2015-07-13T01:15:08.000Z","size":264,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-04T18:38:23.484Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bbqbaron.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-07T22:36:48.000Z","updated_at":"2016-11-21T12:41:05.000Z","dependencies_parsed_at":"2023-03-06T16:45:17.929Z","dependency_job_id":null,"html_url":"https://github.com/bbqbaron/MSE","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbqbaron%2FMSE","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbqbaron%2FMSE/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbqbaron%2FMSE/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbqbaron%2FMSE/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bbqbaron","download_url":"https://codeload.github.com/bbqbaron/MSE/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246217435,"owners_count":20742199,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T10:13:42.813Z","updated_at":"2025-03-29T17:25:15.038Z","avatar_url":"https://github.com/bbqbaron.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Minesweeper in [Elm](elm-lang.org)\n\n## What is Elm?\n* Language that compiles into JS, HTML, and CSS\n* Designed for front-end apps\n\n## Why Elm?\n* Strongly Typed\n    * Haskell-esque\n    * No nulls\n    * Types can have parameters\n* Pure\n    * Testing is easier\n* Built-in FRP\n* More immediately accessible than Haskell\n\n## Functional Primer\n* Function definition\n* Type signatures\n* Function call syntax\n* Signals\n\n## A Simple Elm App - By Convention\n1. A Model\n\n    How do I represent the state of the app?\n\n    `type alias Model = {name : String}`\n\n1. An initializer\n\n    How do I know where the app starts?\n\n    ```\n    init : Model\n    init = { name = \"Steve \"}\n    ```\n\n1. An Action type\n\n    How do I define the changes that may occur to app state?\n\n    `type Action = Noop|ChangeName String`\n\n1. An update function\n\n    How do I determine the effects of an Action on a Model?\n\n    ```\n    update : Action -\u003e Model -\u003e Model\n    update action model =\n        case action of\n            ChangeName someString -\u003e {model|name\u003c-someString}\n            _ -\u003e model\n    ```\n\n1. A Mailbox\n\n    What receives Actions and knows when to change app state?\n\n    ```\n    updates : Mailbox Action\n    updates = mailbox Noop\n    ```\n\n    A mailbox provides:\n\n        1. A Signal, which is the latest Action taken\n\n        1. An Address, which is where UI elements, timers, etc can send Actions\n\n1. A Signal of state\n\n    How do I know the _current_ state of the Model, with all the changes that have happened?\n\n    ```\n    state : Signal Model\n    state = foldp update init updates.signal\n    ```\n\n1. A renderer\n\n    How do I transform the current state of the Model into HTML, with event listeners that will capture user interaction?\n\n    ```\n    render : Address Action -\u003e Model -\u003e Html\n    render channel model = \n        Html.input [Html.Events.on \"input\" Html.Events.targetValue (\\v -\u003e message channel (ChangeName v))] []\n    ```\n\n1. A main function\n\n    Zip everything together. Feed app state into the renderer and sit back waiting for Actions.\n\n    ```\n    main : Signal Html\n    main = render updates.address \u003c~ state\n    ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbqbaron%2Fmse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbbqbaron%2Fmse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbqbaron%2Fmse/lists"}