Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. F#
  3. TypeShape

TypeShape

MITF#10.0.0

A practical F# library for datatype-generic programming using reflection and visitor patterns to minimize boilerplate.

GitHubGitHub
322 stars33 forks0 contributors

What is TypeShape?

TypeShape is an F# library for practical datatype-generic programming. It uses reflection and visitor patterns to derive the algebraic structure of types, enabling developers to write generic programs that work across records, unions, POCOs, and other type shapes with minimal boilerplate and improved performance.

Target Audience

F# developers building serialization libraries, configuration parsers, equality comparers, or other applications requiring generic type manipulation without excessive reflection overhead.

Value Proposition

Developers choose TypeShape for its performance optimizations over raw reflection, extensible architecture for custom type shapes, and support for both traditional and higher-kinded type APIs, making it a versatile tool for generic programming in F#.

Overview

Practical generic programming for F#

Use Cases

Best For

  • Building serialization libraries like FsPickler or FSharp.AWS.DynamoDB picklers
  • Generating pretty printers or parsers for F# types
  • Creating generic equality comparers or hashcode generators
  • Implementing configuration loaders that map to F# records
  • Developing type-safe generic programs with higher-kinded types
  • Extending generic programming to custom type shapes like ISerializable

Not Ideal For

  • Projects using C# or other .NET languages without F# integration
  • Teams needing out-of-the-box serializers or parsers without implementing custom logic
  • Simple applications where basic .NET reflection is sufficient and performance is not critical
  • Environments with strict restrictions on runtime code generation or reflection usage

Pros & Cons

Pros

Performance Optimizations

Benchmarks show significant improvements over raw reflection, as detailed in the performance page, reducing overhead for generic programs.

Extensible Architecture

Supports custom active patterns for arbitrary shapes, like ISerializable, allowing developers to add new type algebras without modifying core library.

F# Type Support

Provides built-in active patterns for F# records, unions, and POCOs, simplifying generic programming for common F# datatypes.

Higher-Kinded Type API

Enables type-safe generic programs with a modern approach, as shown in the HKT examples, reducing boilerplate for advanced use cases.

Cons

F#-Specific Limitation

Primarily designed for F#, making it unsuitable for mixed-language or C#-focused projects, as highlighted by its dependency on F# idioms.

Conceptual Complexity

Requires deep understanding of generic programming concepts and F# patterns, which can be daunting for developers new to datatype-generic programming.

Reflection Dependency

Despite optimizations, it still relies on System.Reflection internally, which may introduce overhead or compatibility issues in reflection-restricted environments.

Frequently Asked Questions

Quick Stats

Stars322
Forks33
Contributors0
Open Issues0
Last commit1 year ago
CreatedSince 2016

Tags

#functional-programming#dotnet#serialization#reflection#fsharp#visitor-pattern#generic-programming#code-generation

Built With

F
F#
.
.NET

Included in

.NET21.2kF#1.4k
Auto-fetched 11 hours ago

Related Projects

PollyPolly

Polly is a .NET resilience and transient-fault-handling library that allows developers to express policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation, and Fallback in a fluent and thread-safe manner. From version 6.0.1, Polly targets .NET Standard 1.1 and 2.0+.

Stars14,236
Forks1,290
Last commit2 days ago
HumanizerHumanizer

Humanizer meets all your .NET needs for manipulating and displaying strings, enums, dates, times, timespans, numbers and quantities

Stars9,865
Forks1,067
Last commit4 days ago
Fluent ValidationFluent Validation

A popular .NET validation library for building strongly-typed validation rules.

Stars9,752
Forks1,276
Last commit27 days ago
CsvHelperCsvHelper

Library to help reading and writing CSV files

Stars5,211
Forks1,104
Last commit1 year ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub