summaryrefslogtreecommitdiff
path: root/utility.hs
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2016-06-20 22:06:58 +0200
committertomsmeding <tom.smeding@gmail.com>2016-06-20 22:06:58 +0200
commit7957dc36354a803ba96231c5bf8397a154f0ca59 (patch)
tree3d3a156d8cbc145a37e4886eeeb2d3abdfa74e1e /utility.hs
parent712dfe8a117207f1d70e0e14f9d6e7ee62c8eadd (diff)
Cleanup + from(Left|Right)
Diffstat (limited to 'utility.hs')
-rw-r--r--utility.hs8
1 files changed, 8 insertions, 0 deletions
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