Hacker News new | ask | show | jobs
by doctorpangloss 703 days ago

    type JokeM a = IO a

    askQuestion :: JokeM String
    askQuestion = do
      putStr "How do you know someone works at Jane Street? "
      hFlush stdout
      getLine

    tellPunchline :: String -> JokeM ()
    tellPunchline _ = putStrLn "They tell you!"

    janeStreetJoke :: JokeM ()
    janeStreetJoke = askQuestion >>= tellPunchline

    main :: IO ()
    main = forever janeStreetJoke
I don't know this feels kind of verbose to me.