-
-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathfunctions.hs
More file actions
35 lines (24 loc) · 677 Bytes
/
functions.hs
File metadata and controls
35 lines (24 loc) · 677 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
next x = x + 1
hypotenuse x y = sqrt (x^2 + y^2)
greet name = "hello" ++ " " ++ name
greet2 :: String -> String
greet2 name = "hello" ++ " " ++ name
greetNext x = (next x, greet (show (next x)))
hello :: String -> String
hello "Olafur" = "hello, Olafur!"
hello "Rocamadour" = "hey!"
hello x = greet x
main =
do
putStrLn (show (next 4))
putStrLn (show (next (next 4)))
putStrLn (show (hypotenuse 3 4))
putStrLn (greet "world")
putStrLn (greet2 "world")
putStrLn (show (greetNext 7))
let (x, y) = greetNext 7
putStrLn (show x)
putStrLn y
putStrLn (hello "Olafur")
putStrLn (hello "Rocamadour")
putStrLn (hello "Jane")