You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

23 lines
533 B

module FixTheCode where
import Control.Monad.Trans.Maybe
import Control.Monad
import Control.Monad.IO.Class
isValid :: String -> Bool
isValid v = '!' `elem` v
maybeExcite :: MaybeT IO String
maybeExcite = do
v <- liftIO getLine -- added liftIO
guard $ isValid v
return v
doExcite :: IO ()
doExcite = do
putStrLn "say something excite!"
excite <- runMaybeT maybeExcite -- added runMaybeT
case excite of
Nothing -> putStrLn "MOAR EXCITE"
Just e -> putStrLn $ "Good, was very excite: " ++ e