Created
January 9, 2020 08:52
-
-
Save hiepph/ac057a40e1e164887ea1d50a22d9d401 to your computer and use it in GitHub Desktop.
sample_haskell_main
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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