Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module Main where
  2.  
  3. import System.Environment
  4. import Data.Char
  5.  
  6. -- Exercise 6.1
  7.  
  8. -- | Capitalize the first letter of a string
  9. capitalize :: String -> String
  10. capitalize []       = []
  11. capitalize (a:as)   = toUpper a : unchange as
  12.   where
  13.     unchange []     = []
  14.     unchange (a:as) = (a:as)
  15.  
  16. main :: IO ()
  17. main = do
  18.   putStrLn "Hello. I am a HAL 9000 series computer."
  19.   name <-  getEnv "USER"
  20.   putStrLn $ "Good morning, " ++ capitalize name ++ "."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement