elm-exercise/Demo/Connection.elm

27 lines
382 B
Elm
Raw Normal View History

2016-04-15 17:30:01 +00:00
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