packages feed

acme-inator-0.1.0.0: EvilPlan.hs

-- | Run an evil plan to increment the Tri-State area with the incrementinator.

module Main (
    main
) where

import Acme.Inator

incrementinator :: EvilInvention Int Int
incrementinator = (+1) . inator

evilPlan :: TriStateArea Int
evilPlan = do
    zap <- activate incrementinator
    as <- mapM zap [1..37]
    b <- zap 38 -- I never really liked the number 38
    selfDestruct incrementinator
    cs <- mapM zap [39..100]
    return $ sum as + b + sum cs

executeEvilPlan :: Maybe Int
executeEvilPlan = whileTrapping perryThePlatypus evilPlan

main :: IO ()
main = do
    putStrLn $
        case executeEvilPlan of
            Nothing -> "Curse you, Perry the Platypus!"
            Just a -> "Aha! I have incremented the tri-state area to " ++ show a