implemented pwCount

This commit is contained in:
Jonathan Lamothe 2018-12-25 16:09:32 -05:00
parent e2a7fa6fc2
commit d874db8da2

View File

@ -41,7 +41,7 @@ module Password (
-- ** Password Generator -- ** Password Generator
pwGenerate, pwGenerate,
-- ** Password Checkers -- ** Password Checkers
pwCountUpper, pwCountLower, pwCountDigits, pwCountSpecial, pwCountUpper, pwCountLower, pwCountDigits, pwCountSpecial, pwCount,
-- ** Database Functions -- ** Database Functions
pwHasService, pwSetService, pwGetService, pwSearch pwHasService, pwSetService, pwGetService, pwSearch
) where ) where
@ -179,7 +179,7 @@ pwCountUpper
-- ^ the password -- ^ the password
-> Int -> Int
-- ^ the count -- ^ the count
pwCountUpper = length . filter isUpper pwCountUpper = pwCount isUpper
-- | counts lower case characters in a password -- | counts lower case characters in a password
pwCountLower pwCountLower
@ -187,7 +187,7 @@ pwCountLower
-- ^ the password -- ^ the password
-> Int -> Int
-- ^ the count -- ^ the count
pwCountLower = length . filter isLower pwCountLower = pwCount isLower
-- | counts digits in a password -- | counts digits in a password
pwCountDigits pwCountDigits
@ -195,7 +195,7 @@ pwCountDigits
-- ^ the password -- ^ the password
-> Int -> Int
-- ^ the count -- ^ the count
pwCountDigits = length . filter isDigit pwCountDigits = pwCount isDigit
-- | counts special characters in a password -- | counts special characters in a password
pwCountSpecial pwCountSpecial
@ -203,7 +203,17 @@ pwCountSpecial
-- ^ the password -- ^ the password
-> Int -> Int
-- ^ the count -- ^ the count
pwCountSpecial = length . filter isSpecial pwCountSpecial = pwCount isSpecial
-- | counts characters matching a specific constraint
pwCount
:: (Char -> Bool)
-- ^ the constraint
-> String
-- ^ the string being checked
-> Int
-- ^ the count
pwCount f = length . filter f
-- | checks to see if a service is in the database -- | checks to see if a service is in the database
pwHasService pwHasService