Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. import Control.Monad
  2. import Data.Char
  3.  
  4. getPassphrase :: IO (Maybe String)
  5. getPassphrase = do s <- getLine
  6. if isValid s then return $ Just s
  7. else return Nothing
  8.  
  9. -- The validation test could be anything we want it to be.
  10. isValid :: String -> Bool
  11. isValid s = length s >= 8
  12. && any isAlpha s
  13. && any isNumber s
  14. && any isPunctuation s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement