Add instances for generating JSON

This commit is contained in:
Evan Czaplicki 2013-12-17 12:16:40 -08:00
parent 26a8c82b6f
commit a3cb09a0c1
2 changed files with 7 additions and 0 deletions

View file

@ -41,6 +41,9 @@ instance FromJSON Name where
parseJSON _ = fail "Project name must be a string."
instance ToJSON Name where
toJSON name = toJSON (show name)
errorMsg string =
unlines
[ "Dependency file has an invalid name: " ++ string

View file

@ -67,3 +67,7 @@ instance FromJSON Version where
]
parseJSON _ = fail "Version number must be stored as a string."
instance ToJSON Version where
toJSON version = toJSON (show version)