Skip to content

Instantly share code, notes, and snippets.

@kolektiv
Created March 11, 2015 09:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kolektiv/171d536a64944c006011 to your computer and use it in GitHub Desktop.
Save kolektiv/171d536a64944c006011 to your computer and use it in GitHub Desktop.
Chiron single case union
type TestUnion =
| Union of string
type TestContainer =
{ Test: TestUnion }
static member FromJson (_: TestContainer) =
fun t ->
{ Test = Union t }
<!> Json.read "union"
static member ToJson (x: TestContainer) =
Json.write "union" ((fun (Union x) -> x) x.Test)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment