PRELUDE: add if' function to simplify if-then-else

This commit is contained in:
hasufell 2014-10-13 22:30:57 +02:00
parent 077d0442f5
commit 9dcf1e30f9
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020

View File

@ -72,3 +72,9 @@ seqList = tail. inits
dupLast :: [a] -> [a] dupLast :: [a] -> [a]
dupLast [] = [] dupLast [] = []
dupLast xs = xs ++ [last xs] dupLast xs = xs ++ [last xs]
-- |Simpler version of if-then-else.
if' :: Bool -> a -> a -> a
if' True x _ = x
if' False _ y = y