-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathElm.elm
More file actions
38 lines (32 loc) · 762 Bytes
/
Elm.elm
File metadata and controls
38 lines (32 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
module Main exposing (main)
-- See this code in action at https://ellie-app.com/6SMCPFqXrqsa1
import Html exposing (Html, text, div, br)
import String exposing (fromInt)
import List
import Browser
add : Int -> Int -> Int
add a =
(+) a
each : (a -> b) -> List a -> List b
each f list =
case list of
[] ->
[]
x :: xs ->
f x :: each f xs
printHtmlString : Int -> Html ()
printHtmlString =
text << fromInt
view : () -> Html ()
view _ =
div []
([ printHtmlString <| add 1 2 ] ++ [br [] [] ] ++ each printHtmlString [ 1, 2, 3 ])
update : () -> () -> ()
update _ _ = ()
main : Program () () ()
main =
Browser.sandbox
{ init = ()
, view = view
, update = update
}