aboutsummaryrefslogtreecommitdiff
path: root/src/Model/Edition/TimeEdition.elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/Model/Edition/TimeEdition.elm')
-rw-r--r--src/Model/Edition/TimeEdition.elm52
1 files changed, 0 insertions, 52 deletions
diff --git a/src/Model/Edition/TimeEdition.elm b/src/Model/Edition/TimeEdition.elm
deleted file mode 100644
index 3b70c3d..0000000
--- a/src/Model/Edition/TimeEdition.elm
+++ /dev/null
@@ -1,52 +0,0 @@
-module Model.Edition.TimeEdition
- ( keyCodeToChar
- , toTime
- , toMinutesAndSeconds
- ) where
-
-import Time exposing (Time)
-import List
-import Array
-import String
-import Keyboard exposing (KeyCode)
-import Char
-
-import Utils.List exposing (..)
-import Utils.Maybe exposing (..)
-
-keyCodeToChar : KeyCode -> Maybe Char
-keyCodeToChar code =
- let char = Char.fromCode code
- in if Char.isDigit char
- then Just char
- else Nothing
-
-toTime : List Char -> Time
-toTime numbers =
- numbers
- |> toMinutesAndSeconds
- |> \(a, b) -> (stringToInt a, stringToInt b)
- |> \(minutes, seconds) -> (toFloat minutes) * 60 * 1000 + (toFloat seconds) * 1000
-
-toMinutesAndSeconds : List Char -> (String, String)
-toMinutesAndSeconds numbers =
- numbers
- |> List.take 4
- |> List.reverse
- |> completeBegin '0' 4
- |> splitAt 2
- |> \(a, b) -> (String.fromList a, String.fromList b)
-
-completeBegin : a -> Int -> List a -> List a
-completeBegin x count xs =
- let length = List.length xs
- in List.append (repeat (count - length) x) xs
-
-stringToInt : String -> Int
-stringToInt str =
- str
- |> String.toInt
- |> \res ->
- case res of
- Ok n -> n
- Err _ -> 0