Type Slowly

Mar 17

Fans of Arrested Development will doubtless already be familiar with Gob’s Program - but who would have thought it’d make such a good bit of instructional Haskell, covering infinite lists and lazy evaluation, list comprehensions, pattern matching, as well as Monadic IO and control flow, all in only 10 lines?

import System.Exit
import Control.Monad
main = do
  putStrLn "Gob's Program: Y/N?"
  ans <- getLine
  case ans of
    "Y" -> sequence_ $ map putStr penuses
    _   -> exitSuccess

penuses = ["Penus " | _ <- [1..]]

blog comments powered by Disqus
Page 1 of 1