Commit 1b7cf8ca authored by Iustin Pop's avatar Iustin Pop
Browse files

Some more utility functions

parent e5f02e15
......@@ -3,6 +3,7 @@
module Utils where
import Data.List
import Data.Either
import Debug.Trace
......@@ -10,6 +11,19 @@ import Debug.Trace
debug :: Show a => a -> a
debug x = trace (show x) x
-- | Check if the given argument is Left something
isLeft :: Either a b -> Bool
isLeft val =
case val of
Left _ -> True
_ -> False
fromLeft :: Either a b -> a
fromLeft = either (\x -> x) (\_ -> undefined)
fromRight :: Either a b -> b
fromRight = either (\_ -> undefined) id
-- | Comma-join a string list.
commaJoin :: [String] -> String
commaJoin = intercalate ","
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment