summaryrefslogtreecommitdiff
blob: c4db397d1a9933b01017b3162098a8238f26e4f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
module Util.List exposing (pop)

import List

pop : List a -> (Maybe (a, List a))
pop l =
   case
      ((List.head l), (List.tail l))
   of
      (Nothing, _) -> Nothing
      (_ , Nothing) -> Nothing
      ((Just head), (Just tail)) -> (Just (head, tail))