Skip to content

Instantly share code, notes, and snippets.

@Javran
Created April 10, 2016 02:11
Show Gist options
  • Select an option

  • Save Javran/5d9ba341a31dba4d6b51336203249ff5 to your computer and use it in GitHub Desktop.

Select an option

Save Javran/5d9ba341a31dba4d6b51336203249ff5 to your computer and use it in GitHub Desktop.
module Vehora where
import Control.Monad
import Control.Monad.Fix
logIn :: IO ()
logIn = do
putStrLn "% Enter password:"
fix $ \go -> do
guess <- getLine
when (guess /= "secret") $ do
putStrLn "% Wrong password!"
putStrLn "% Try again:"
go
putStrLn "$ Congratulations!"
main :: IO ()
main = logIn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment