on master help sign in
Add instances for generating JSON
commita3cb09a0c152ed6dda8892c6cea97dc7e59c586c authorEvan Czaplicki <info@elm-lang.org> dateTue 17 Dec 2013, 12:16 (13 years ago) parent26a8c82
2 files changed+7
compiler/Elm/Internal/Name.hs+3 compiler/Elm/Internal/Version.hs+4
compiler/Elm/Internal/Name.hs+3
@@ -41,6 +41,9 @@ instance FromJSON Name where
4141
4242 parseJSON _ = fail "Project name must be a string."
4343
44+instance ToJSON Name where
45+ toJSON name = toJSON (show name)
46+
4447errorMsg string =
4548 unlines
4649 [ "Dependency file has an invalid name: " ++ string
compiler/Elm/Internal/Version.hs+4
@@ -67,3 +67,7 @@ instance FromJSON Version where
6767 ]
6868
6969 parseJSON _ = fail "Version number must be stored as a string."
70+
71+instance ToJSON Version where
72+ toJSON version = toJSON (show version)
73+