diff options
author | Tom Smeding <tom.smeding@gmail.com> | 2018-04-19 11:45:46 +0200 |
---|---|---|
committer | Tom Smeding <tom.smeding@gmail.com> | 2018-04-19 11:45:46 +0200 |
commit | af425841a63ee73603cc09510d95a36e646ddafd (patch) | |
tree | 08a1ef8435ec0ab07887256a1c86f908c2389a1a /utility.hs | |
parent | 8d9d27d64d9e39ea76fd878e928e553944735e45 (diff) |
Build with stack
Diffstat (limited to 'utility.hs')
-rw-r--r-- | utility.hs | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/utility.hs b/utility.hs deleted file mode 100644 index a160cb7..0000000 --- a/utility.hs +++ /dev/null @@ -1,28 +0,0 @@ -module Utility where - -import Data.List - ---if any of the predicates returns true, options returns true -options :: [a -> Bool] -> a -> Bool -options l x = any id [f x | f <- l] - -fixpoint :: (Eq a) => (a -> a) -> a -> a -fixpoint f x = let fx = f x in if fx == x then x else fixpoint f fx - -setcompareBy :: (a -> a -> Bool) -> [a] -> [a] -> Bool -setcompareBy _ [] [] = True -setcompareBy _ [] _ = False -setcompareBy _ _ [] = False -setcompareBy p a@(x:xs) b = length a == length b && setcompareBy p xs (deleteBy p x b) - -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 |