From da3f71bfc01b3d3dd63d186e16cb515076f9bc35 Mon Sep 17 00:00:00 2001 From: hasufell Date: Wed, 8 Oct 2014 16:27:59 +0200 Subject: [PATCH] Add removeItem utility function --- Util.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Util.hs b/Util.hs index 95c0524..9058b4f 100644 --- a/Util.hs +++ b/Util.hs @@ -11,3 +11,8 @@ splitBy f s = case dropWhile f s of [] -> [] s' -> w : splitBy f s'' where (w, s'') = break f s' + + +-- |Remove a given item from a list. +removeItem :: (Eq a) => a -> [a] -> [a] +removeItem x = foldr (\x' y -> if x' == x then y else x':y) []