From b3076f37700291221ededbaf996a065b006cf42d Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Sun, 22 Mar 2015 17:13:04 +0100 Subject: Do not add more than one space when editing name --- src/Utils/List.elm | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/Utils/List.elm') 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 -- cgit v1.2.3