From 973a039b54327df74396605410ea9abe19c8a4e7 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 4 Sep 2016 21:21:11 +0200 Subject: Upgrade to elm 0.17.1 --- src/Model.elm | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/Model.elm (limited to 'src/Model.elm') 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 -- cgit v1.2.3