Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- hello.hs
- main :: IO()
- main = do
- putStrLn "Hello, world."
- putStrLn "Hello, from Haskell."
- -- helloname.hs
- main :: IO()
- main = do
- putStr "Enter your name: "
- name <- getLine
- putStrLn ("Hello, " ++ name)
- -- myfuncs.hs
- f :: Double -> Double
- f x = 2*x
- mysum :: Double -> Double -> Double
- mysum a b = a + b
- -- taxi.hs
- main :: IO()
- main = do
- putStr "Enter distance in km: "
- km_input <- getLine
- let km = read km_input :: Double
- let price = taxiPrice km
- putStrLn ("Taxi price: " ++ (show price))
- taxiPrice :: Double -> Double
- taxiPrice x = 2 + 1.2*x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement