Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Control.Monad
- import Data.Char
- getPassphrase :: IO (Maybe String)
- getPassphrase = do s <- getLine
- if isValid s then return $ Just s
- else return Nothing
- -- The validation test could be anything we want it to be.
- isValid :: String -> Bool
- isValid s = length s >= 8
- && any isAlpha s
- && any isNumber s
- && any isPunctuation s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement