Created
March 15, 2017 16:43
-
-
Save miguelarian/35de2f1f5a5c3166f39c29c933bd8b8a to your computer and use it in GitHub Desktop.
update
This file contains hidden or 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
update : Msg -> Model -> ( Model, Cmd Msg ) | |
update msg model = | |
case msg of | |
Add -> | |
let | |
res = | |
model.op1 + model.op2 | |
in | |
( { model | result = res }, Cmd.none ) | |
Sub -> | |
let | |
res = | |
model.op1 - model.op2 | |
in | |
( { model | result = res }, Cmd.none ) | |
Mult -> | |
let | |
res = | |
model.op1 * model.op2 | |
in | |
( { model | result = res }, Cmd.none ) | |
Div -> | |
let | |
res = | |
model.op1 / model.op2 | |
in | |
( { model | result = res }, Cmd.none ) | |
Operator1Changed newValue -> | |
( { model | op1 = parseFloat newValue }, Cmd.none ) | |
Operator2Changed newValue -> | |
( { model | op2 = parseFloat newValue }, Cmd.none ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment