diff options
author | Joris | 2016-09-04 21:21:11 +0200 |
---|---|---|
committer | Joris | 2016-09-04 21:21:31 +0200 |
commit | 973a039b54327df74396605410ea9abe19c8a4e7 (patch) | |
tree | c702564d17e0a490d56845027238eb4f231be785 /src/Model.elm | |
parent | 62fee9133f36f655c1ed83e0c2e85394f9948bf5 (diff) |
Upgrade to elm 0.17.1
Diffstat (limited to 'src/Model.elm')
-rw-r--r-- | src/Model.elm | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/Model.elm b/src/Model.elm new file mode 100644 index 0000000..6e75c39 --- /dev/null +++ b/src/Model.elm @@ -0,0 +1,40 @@ +module Model exposing + ( Model + , init + , numberOfTimers + ) + +import Dict exposing (Dict) +import Dict +import Time exposing (Time) +import List + +import Msg exposing (Msg) + +import Model.Id exposing (..) +import Model.IdGenerator exposing (..) + +import Timer.Model as Timer exposing (Timer) + +import Edition.Model exposing (Edition) + +type alias Model = + { time : Time + , timers : Dict Id Timer + , timerIdGenerator : IdGenerator + , edition : Maybe Edition + } + +init : Time -> (Model, Cmd Msg) +init initialTime = + let (id, idGenerator) = getId initialIdGenerator + model = + { time = initialTime + , timers = Dict.insert id (Timer.init initialTime) Dict.empty + , timerIdGenerator = idGenerator + , edition = Nothing + } + in (model, Cmd.none) + +numberOfTimers : Model -> Int +numberOfTimers = List.length << Dict.toList << .timers |