MessagePack Extensions for F#. / msgpack.org[F#]
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
sandbox
src/MessagePack.FSharpExtensions
tests
.gitignore
.travis.yml
LICENSE
MessagePack.FSharpExtensions.sln
README.md
RELEASE_NOTES.md
appveyor.yml

README.md

MessagePack.FSharpExtensions

NuGet Status Build status Build Status

MessagePack.FSharpExtensions is a MessagePack-CSharp extension library for F#.

Usage

open MessagePack
open MessagePack.Resolvers
open MessagePack.FSharp

CompositeResolver.RegisterAndSetAsDefault(
  FSharpResolver.Instance,
  StandardResolver.Instance
)

[<MessagePackObject>]
type UnionSample =
  | Foo of XYZ : int
  | Bar of OPQ : string list

let data = Foo 999

let bin = MessagePackSerializer.Serialize(data)

match MessagePackSerializer.Deserialize<UnionSample>(bin) with
| Foo x ->
  printfn "%d" x
| Bar xs ->
  printfn "%A" xs