Skip to content

Instantly share code, notes, and snippets.

@lilac
Created June 5, 2019 13:00
Show Gist options
  • Save lilac/2fa30a61f9b77f08aab7df1c0ac18b22 to your computer and use it in GitHub Desktop.
Save lilac/2fa30a61f9b77f08aab7df1c0ac18b22 to your computer and use it in GitHub Desktop.
Json type in Dotty
case class Obj(val elems: (String, json)*) derives Eql
case class Arr(val elems: json*)
type json = Number | String | Obj | Arr
val s: json = Obj("a" -> 3, "b" -> "cd", "ar" -> Arr(1, "abc"))
println(s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment