From aa66512620b4a1a14cbe3c571b72e078032eae2a Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Mon, 20 Apr 2015 00:36:44 +0200 Subject: [PATCH] Add code snippets --- Code.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Code.hs b/Code.hs index d53bcab..56c1dc8 100644 --- a/Code.hs +++ b/Code.hs @@ -39,3 +39,15 @@ calcSomething :: Int -> MaybeInt calcSomething x | x < 100 = NoError (x * 5) | otherwise = Error "Int out of range!" + + +f' :: Int -> Int +f' x = let y p = x + p + in x + (y 2) + +addTwo :: [Int] -> [Int] +addTwo [] = [] +addTwo (x:xs) = (x + 2) : addTwo xs + +f'' :: String -> Bool +f'' xs = even . length . (\x -> x ++ "Hello world") $ xs