on master help sign in
Add instances for generating JSON
a3cb09aEvan Czaplicki
compiler/Elm/Internal/Name.hs+3
@@ -41,6 +41,9 @@ instance FromJSON Name where
41
41
42 parseJSON _ = fail "Project name must be a string."
42 parseJSON _ = fail "Project name must be a string."
43
43
44+instance ToJSON Name where
45+ toJSON name = toJSON (show name)
46+
44errorMsg string =
47errorMsg string =
45 unlines
48 unlines
46 [ "Dependency file has an invalid name: " ++ string
49 [ "Dependency file has an invalid name: " ++ string
compiler/Elm/Internal/Version.hs+4
@@ -67,3 +67,7 @@ instance FromJSON Version where
67 ]
67 ]
68
68
69 parseJSON _ = fail "Version number must be stored as a string."
69 parseJSON _ = fail "Version number must be stored as a string."
70+
71+instance ToJSON Version where
72+ toJSON version = toJSON (show version)
73+