diff options
Diffstat (limited to 'utility.hs')
-rw-r--r-- | utility.hs | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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 |