elm-exercise/Demo/Connection.elm
Correl Roush f6f5868bef Solution
2016-04-15 13:42:05 -04:00

26 lines
382 B
Elm

module Demo.Connection (..) where
type State
= Online
| Connecting
| Offline
type Action
= Connect
| Connected
| Disconnect
update : Action -> State -> State
update action state =
case (state, action) of
(Offline, Connect) ->
Connecting
(Connecting, Connected) ->
Online
(Online, Disconnect) ->
Offline
_ ->
state