Created
August 11, 2017 19:55
-
-
Save exallium/6e9dfd662b410fd0304338277e12ff0b 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
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