-
-
Save wayneseymour/d207351156b08845fa0f78727508a4b2 to your computer and use it in GitHub Desktop.
This file contains 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
data Parser = WebParser | DbParser | |
class ParseStrategy p where | |
parse :: p -> String -> String | |
instance ParseStrategy Parser where | |
parse WebParser s = "code for parsing web stuff goes here" | |
parse DbParser s = "code for parsing db stuff goes here" | |
fromDB = parse DbParser | |
fromWeb = parse WebParser | |
main :: IO () | |
main = do | |
-- decide which parser to utilize | |
let s = fromDB "asdf" | |
putStrLn s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment