aboutsummaryrefslogtreecommitdiff
path: root/src/Model/Model.elm
diff options
context:
space:
mode:
authorJoris Guyonvarch2015-03-16 00:15:05 +0100
committerJoris Guyonvarch2015-03-16 00:15:05 +0100
commitcd3b37adebca99138fad1acca37908183036ace9 (patch)
treed566ae0564d82ab94901e4deda98f36abd22ad2d /src/Model/Model.elm
Initial commit, can create and name 5 minute timers, can toggle running state
Diffstat (limited to 'src/Model/Model.elm')
-rw-r--r--src/Model/Model.elm32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/Model/Model.elm b/src/Model/Model.elm
new file mode 100644
index 0000000..fa97d7b
--- /dev/null
+++ b/src/Model/Model.elm
@@ -0,0 +1,32 @@
+module Model.Model
+ ( Model
+ , initialModel
+ , substractTimersTime
+ ) where
+
+import Dict (Dict)
+import Dict
+import Time (Time)
+
+import Model.Timer (..)
+import Model.Id (..)
+import Model.IdGenerator (..)
+
+type alias Model =
+ { currentTime : Time
+ , newTimerName : String
+ , timers : Dict Id Timer
+ , timerIdGenerator : IdGenerator
+ }
+
+initialModel : Time -> Model
+initialModel initialTime =
+ { currentTime = initialTime
+ , newTimerName = ""
+ , timers = Dict.empty
+ , timerIdGenerator = initialIdGenerator
+ }
+
+substractTimersTime : Time -> Dict Id Timer -> Dict Id Timer
+substractTimersTime t timers =
+ Dict.map (\id timer -> substractTimerTime t timer) timers