Friday, 27 September 2013

Why this [haskell] compilation error?

Why this [haskell] compilation error?

module Main
alicebob :: String -> String
alicebob "alice" = "Hi alice"
alicebob "bob" = "Hi bob"
alicebob _ = "Hi person whose name is neither alice nor bob."
greet :: IO ()
greet = do
putStrLn "hi. whats your name?"
name <- getLine
putStrLn (alicebob name)
Simple programming exercise to get some user input, and reply. Just
starting to learn haskell so please excuse the simple question. Getting an
error on line alicebob :: String -> String. How can I fix it?

No comments:

Post a Comment