From 7957dc36354a803ba96231c5bf8397a154f0ca59 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Mon, 20 Jun 2016 22:06:58 +0200 Subject: Cleanup + from(Left|Right) --- utility.hs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'utility.hs') diff --git a/utility.hs b/utility.hs index c442f80..a160cb7 100644 --- a/utility.hs +++ b/utility.hs @@ -18,3 +18,11 @@ setcompareBy p a@(x:xs) b = length a == length b && setcompareBy p xs (deleteBy deleteIndex :: Int -> [a] -> [a] deleteIndex 0 (_:xs) = xs deleteIndex i (x:xs) | i > 0 = x : deleteIndex (i-1) xs + +fromLeft :: Either a b -> a +fromLeft (Left a) = a +fromLeft (Right _) = undefined + +fromRight :: Either a b -> b +fromRight (Left _) = undefined +fromRight (Right b) = b -- cgit v1.2.3-54-g00ecf