Skip to content

twaddell/MessagePack.LanguageExt

Repository files navigation

GitHub NuGet version (MessagePack.LanguageExt) Build status

MessagePack.LanguageExt

This library adds support for LanguageExt types to MessagePack C#

Getting Started

Installation

Prerequisities for C#

This library is provided in NuGet.

Support for .NET Framework 4.6.1 and .NET Standard 2.0.

In the Package Manager Console -

Install-Package MessagePack.LanguageExt

or download directly from NuGet.

How to use

To use the LanguageExt resolver, you will have to add it to the composite resolver, as shown in the example below:

var resolver = CompositeResolver.Create(
            BuiltinResolver.Instance,
            LanguageExtResolver.Instance,
            ContractlessStandardResolver.Instance
            );
			
MessagePackSerializer.DefaultOptions = ContractlessStandardResolver.Options.WithResolver(resolver);  

Quick Start

For more information on either MessagePack or LanguageExt, please follow the respective links below.

This is a quick guide on a basic serialization and de-serialization of a LanguageExt type.

Lst<int> list = List(1, 2, 3, 4, 5);;
var bin = MessagePackSerializer.Serialize(list);
var res = MessagePackSerializer.Deserialize<Lst<int>>(bin);
// inst == res

Usage

Supported LanguageExt types

Arr<T>, Seq<T>, Lst<T>, Map<K,V>, Set<T>, HashSet<T>, HashMap<K,V> Que<T>, Stck<T>, Option<T>, and Either<L,R>

Contributing

TBC

Links

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments