Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ ghci
- GHCi, version 7.8.4: http://www.haskell.org/ghc/ :? for help
- Prelude> :set prompt "> "
- > import Control.Applicative
- > import Control.Monad
- > :set -XOverloadedStrings
- > import Data.Text
- > import Data.Text.IO
- > import Prelude hiding (getLine, putStrLn)
- > let ask = putStrLn "Are you sad?" >> isPrefixOf "y" <$> getLine
- > let stop = putStrLn "Stop!"
- > let beAwesome = putStrLn "Be awesome!"
- > sad <- ask
- Are you sad?
- yeah
- > when sad (stop >> beAwesome)
- Stop!
- Be awesome!
- >
- Leaving GHCi.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement