Final exam was scheduled for December 21st. That’s very late. Instead, we’ll either:
Will confirm next week.
A technique for abstract data types, sometimes called a “smart constructor”. Define a data type, and make the type itself public, but the constructor(s) are private.
Lists are convenient, but not very efficient.
import qualified Data.Map as M
tally :: Char -> M.Map Char Int -> M.Map Char Int tally c m = case M.lookup c m of Nothing -> M.insert c 1 m Just k -> M.insert c (k+1) m
main = return ()
mymain = do putStrLn "Hello, world." putStr "What is your name? " name <- getLine putStrLn $ "Welcome, " ++ name