Skip to content
This repository was archived by the owner on Jun 10, 2026. It is now read-only.
This repository was archived by the owner on Jun 10, 2026. It is now read-only.

Allow serializers for a generic type #4

Description

@msdvoits

I need serialization of generic types.

Let I have a generic type:

type T<'a>(a: 'a) =
   member x.A = a

I want to serialize instances of this type T(10), T("abc") and would create a serializer type as follows:

let TSerializer<'a>() =
  interface ISerializer<'a> with
    member x.TypeId = "T"
    member x.Serialize _ t -> ...
    member x.Deserializer _ is -> ...

Now only non-generic serializers can be registered in a serializer library. But still it seems possible to do the following, if a serializer type has same order and number of type parameters as its target type:

lib.Register(typedefof<TSerializer<_>>)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions