-
-
Save dredozubov/7a5e559d77ed580b2e75 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
import qualified Data.ByteString as BS | |
data Config = Config { | |
cfg_home :: Maybe FilePath | |
} | |
instance FromJSON Config where | |
parseJSON (Object o) = ... | |
main = do | |
jsonContents <- BS.readFile "your-config-file.json" | |
let decoded = (eitherDecode jsonContents :: Either String Config) | |
case decoded of | |
(Left err) -> print "error" | |
(Right v) -> doWhateverYouDo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment