Skip to content

Commit

Permalink
elm: init
Browse files Browse the repository at this point in the history
  • Loading branch information
ii8 committed Nov 28, 2023
1 parent 849559f commit 8781cae
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions lang/elm
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
language = "elm"
name = "Elm"
homepage = Just "https://elm-lang.org/"
spec = Tutorial
status = Unmaintained

impl = Standalone
domain = [ UserInterface ]
platform = [ Web ]

typing = Static
safety = TypeSafe
mm = AutomaticMM
everything = AMess

paradigms = [ Functional, EventDriven ]
parallelism = [ ]
features = [ Closures, NominalTyping, TypeInference ]
concurrency = [ ]
runtime = [ Stack, Interpreter, Scheduler, GarbageCollector, ErrorHandling, Abstraction, VirtualMachine ]

orthogonality = Impressive
example =
"""
module Main exposing (..)
import Browser
import Html exposing (Html, button, div, text)
import Html.Events exposing (onClick)

main = Browser.sandbox { init = init, update = update, view = view }

type alias Model = Int

init : Model
init = 0

type Msg = Increment | Decrement

update : Msg -> Model -> Model
update msg model =
case msg of
Increment -> model + 1
Decrement -> model - 1

view : Model -> Html Msg
view model =
div []
[ button [ onClick Decrement ] [ text "-" ]
, div [] [ text (String.fromInt model) ]
, button [ onClick Increment ] [ text "+" ]
]
"""

0 comments on commit 8781cae

Please sign in to comment.