diff options
author | Joris Guyonvarch | 2015-03-18 00:32:17 +0100 |
---|---|---|
committer | Joris Guyonvarch | 2015-03-18 00:32:17 +0100 |
commit | 2613aeeae0f4de44842ff0e796603d0316a61a14 (patch) | |
tree | 722a21c69597e6d2547ad9f991e7c73afae78058 /src/Utils | |
parent | 0075abf51db5d1b54117525d7a7f9b06e31c9484 (diff) |
Can edit the time, unfortunately the enter key is overriden so the '+' key of the numpad is used instead
Diffstat (limited to 'src/Utils')
-rw-r--r-- | src/Utils/List.elm | 17 | ||||
-rw-r--r-- | src/Utils/Maybe.elm | 13 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/Utils/List.elm b/src/Utils/List.elm new file mode 100644 index 0000000..6895d83 --- /dev/null +++ b/src/Utils/List.elm @@ -0,0 +1,17 @@ +module Utils.List + ( repeat + , splitAt + ) where + +import List + +repeat : Int -> a -> List a +repeat count elem = + if count > 0 + then + elem :: (repeat (count - 1) elem) + else + [] + +splitAt : Int -> List a -> (List a, List a) +splitAt n xs = (List.take n xs, List.drop n xs) diff --git a/src/Utils/Maybe.elm b/src/Utils/Maybe.elm new file mode 100644 index 0000000..25d02e7 --- /dev/null +++ b/src/Utils/Maybe.elm @@ -0,0 +1,13 @@ +module Utils.Maybe + ( filterMaybe + ) where + +filterMaybe : (a -> Bool) -> Maybe a -> Maybe a +filterMaybe cond maybe = + case maybe of + Just x -> + if cond x + then Just x + else Nothing + Nothing -> + Nothing |