Created
August 22, 2013 10:08
-
-
Save qoelet/6305451 to your computer and use it in GitHub Desktop.
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
-- just giving functors and the applicative operators a test drive | |
import Control.Applicative | |
import Data.Char | |
emails :: [String] | |
emails = ["[email protected]", "[email protected]", "somethingthatsmellslikeSPAM", "[email protected]", "[email protected]"] | |
hasAt :: [Char] -> Bool | |
hasAt [] = False | |
hasAt (x:xs) | x == '@' = True | |
| otherwise = hasAt xs | |
main = print $ (++) <$> ["Maybe valid: "] <*> (filter hasAt $ [(map toLower) email | email <- emails]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment