aboutsummaryrefslogtreecommitdiff
path: root/src/Utils
diff options
context:
space:
mode:
authorJoris Guyonvarch2015-03-22 17:13:04 +0100
committerJoris Guyonvarch2015-03-22 17:13:04 +0100
commitb3076f37700291221ededbaf996a065b006cf42d (patch)
tree26535eb8756329565529f2c5383701aa41c06c17 /src/Utils
parente7237e9f2a01197890d85b6ecc223e4022630cb8 (diff)
Do not add more than one space when editing name
Diffstat (limited to 'src/Utils')
-rw-r--r--src/Utils/List.elm7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Utils/List.elm b/src/Utils/List.elm
index 64ebaa5..83b11eb 100644
--- a/src/Utils/List.elm
+++ b/src/Utils/List.elm
@@ -1,6 +1,7 @@
module Utils.List
( repeat
, splitAt
+ , maybeHead
, maybeTail
) where
@@ -17,6 +18,12 @@ repeat count elem =
splitAt : Int -> List a -> (List a, List a)
splitAt n xs = (List.take n xs, List.drop n xs)
+maybeHead : List a -> Maybe a
+maybeHead xs =
+ case xs of
+ x :: _ -> Just x
+ _ -> Nothing
+
maybeTail : List a -> Maybe (List a)
maybeTail xs =
case xs of