Add code snippets

Cette révision appartient à :
Julian Ospald 2015-04-20 00:36:44 +02:00
Parent 86969074e3
révision aa66512620
Signature inconnue de Gitea
ID de la clé GPG: 220CD1C5BDEED020
1 fichiers modifiés avec 12 ajouts et 0 suppressions

12
Code.hs
Voir le fichier

@ -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