Skip to content

Instantly share code, notes, and snippets.

@hiepph
Created January 9, 2020 08:52
Show Gist options
  • Save hiepph/ac057a40e1e164887ea1d50a22d9d401 to your computer and use it in GitHub Desktop.
Save hiepph/ac057a40e1e164887ea1d50a22d9d401 to your computer and use it in GitHub Desktop.
sample_haskell_main
module Main where
import Data.Char
import Data.List
strong :: String -> Bool
strong s = length s > 14 &&
any (\c -> c `elem` ['A'..'Z']) s &&
any (\c -> c `elem` ['a'..'z']) s &&
any (\c -> c `elem` ['1'..'9']) s
main = do
putStrLn "Enter your password:"
p <- getLine
if strong p then putStrLn "OK" >> return ()
else putStrLn "weak!" >> main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment