Last active
December 11, 2015 14:09
-
-
Save jorendorff/4612534 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 JSON = JSONNull | |
| JSONBool Bool | |
| JSONNumber Double | |
| JSONString String | |
| JSONArray [JSON] | |
| JSONObject [(String, JSON)] | |
deriving (Eq, Ord, Show) |
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 java.util.HashMap | |
abstract class JSON | |
case class JSONNull() extends JSON | |
case class JSONBoolean(v: Boolean) extends JSON | |
case class JSONNumber(v: Double) extends JSON | |
case class JSONString(v: Double) extends JSON | |
case class JSONArray(elems: Array[JSON]) extends JSON | |
case class JSONObject(props: HashMap[String, JSON]) extends JSON |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment