Skip to content

Instantly share code, notes, and snippets.

@jorendorff
Last active December 11, 2015 14:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jorendorff/4612534 to your computer and use it in GitHub Desktop.
Save jorendorff/4612534 to your computer and use it in GitHub Desktop.
data JSON = JSONNull
| JSONBool Bool
| JSONNumber Double
| JSONString String
| JSONArray [JSON]
| JSONObject [(String, JSON)]
deriving (Eq, Ord, Show)
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