@marc_zboncak
1
|
if x > 0 then "positive" else "zero or negative" |
1 2 |
factorial 0 = 1 factorial n = n * factorial (n-1) |
1 2 3 4 5 6 7 8 9 |
startsWithVowel :: String -> String startsWithVowel str@(c:cs) = case c of 'a' -> "an " ++ str 'e' -> "an " ++ str 'i' -> "an " ++ str 'o' -> "an " ++ str 'u' -> "an " ++ str _ -> "a " ++ str |
1 2 3 4 5 6 7 8 |
data MyException = MyException String instance Exception MyException myFunction :: Int -> IO () myFunction x | x < 0 = throwIO $ MyException "Negative number!" | otherwise = putStrLn "Positive number" |
@marc_zboncak