Created
December 8, 2021 14:04
-
-
Save lonnelars/0e46bf85de45f90e1aeb3358ec010c2f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main exposing (..) | |
import Browser | |
import Html exposing (..) | |
import Html.Attributes exposing (value) | |
import Html.Events exposing (onInput) | |
type Msg | |
= NewInput String | |
type alias Model = | |
{ input : String, result1 : String, result2 : String } | |
init : Model | |
init = | |
let | |
input = | |
"" | |
in | |
{ input = input | |
, result1 = solution input | |
, result2 = solution2 input | |
} | |
update : Msg -> Model -> Model | |
update msg model = | |
case msg of | |
NewInput input -> | |
{ model | result1 = solution input, result2 = solution2 input } | |
solution : String -> String | |
solution input = | |
"not implemented" | |
solution2 : String -> String | |
solution2 input = | |
"not implemented" | |
view : Model -> Html Msg | |
view model = | |
main_ [] | |
[ div [] | |
[ h2 [] [ text "Input" ] | |
, textarea [ onInput NewInput, value model.input ] [] | |
] | |
, div [] | |
[ h2 [] [ text "Result 1" ] | |
, p [] [ text model.result1 ] | |
] | |
, div [] | |
[ h2 [] [ text "Result 2" ] | |
, p [] [ text model.result2 ] | |
] | |
] | |
main : Program () Model Msg | |
main = | |
Browser.sandbox { init = init, view = view, update = update } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment