-
-
Save dminuoso/d4e8fc5fa0c647a6fd1bfa342614b840 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 Config = Config | |
{ cfgUser :: Maybe String | |
, cfgHost :: String | |
, cfgPort :: Int | |
} | |
word :: Parser String | |
word = ... | |
number :: Parser Int | |
number = ... | |
assign :: Parser a -> String -> Parser a | |
assign = ... | |
assignMaybe :: Parser a -> String -> Parser (Maybe a) | |
assignMaybe = ... | |
config :: Parser Config | |
config = | |
Config <$> assignMaybe word "user" | |
<*> assign word "host" | |
<*> assign number "port" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment