Skip to content
CAI
Software that uses CAICheck a score

eiriktsarpalis/TypeShape

52.3

Weak · 24 September 2026

7.5k

lines of production code

F#

primary language

5

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

TypeShape is a .NET library that provides structural type analysis and code generation capabilities for both F\# and C\#. It enables generic programming by allowing users to inspect, clone, map, and serialize arbitrary object graphs and union types at runtime. The system supports advanced features such as deep cloning, size calculation, and the construction of generic programs through higher-kinded type abstractions.

Features

Add new samples for serialization, cloning, and functional programming patterns

The samples directory now includes new examples for CBOR and JSON serialization, a generic structural disposer, an equality comparer generator, a pretty printer, a pickler, and functional programming abstractions (Functor, Applicative, Monad) via Typeclassopedia. Additionally, a BufferDictionary helper for efficient ReadOnlySpan lookups and Net6-specific type builders for DateOnly/TimeOnly are added to the samples.

samples · high confidence

Add structural utilities for cloning, mapping, empty values, size calculation, and union contracts

Introduced new modules in the TypeShape library to support advanced type-shape operations. The Clone module provides a generic deep-cloning mechanism that handles cyclic object graphs and supports F\# records, unions, and POCOs. The Combinators module adds generic iteration and mapping capabilities for traversing and transforming type shapes. The Empty module enables generating structural 'empty' values for any type, useful for default initialization. The Sizeof module offers a generic size calculator for arbitrary object graphs. Additionally, the UnionContract module implements a pattern for serializing F\# union types to a flat, schemaless format, including an encoder/decoder abstraction and a BoxEncoder implementation.

src/TypeShape/Applications · high confidence

Added HKT builder interfaces and folding logic for generic program construction

The TypeShape library now includes a new HKT (Higher-Kinded Types) module that provides builder interfaces for constructing generic programs. This adds support for a wide range of .NET and F\# types, including primitives (bool, int, string, etc.), generic types (Nullable, Array, Dictionary), and F\#-specific types (Option, List, Map, Tuple2). The implementation introduces a folding context that recursively resolves type shapes and supports caching for performance. This change enables users to build generic programs that can handle arbitrary subsets of supported types through composable builder interfaces.

src/TypeShape/HKT · high confidence

Initial project structure and build infrastructure

The repository was initialized with a complete project structure, including a .NET 8.0 SDK configuration, FAKE 5 build scripts, and solution files for the main library, tests, and samples. This adds the foundational build and configuration files necessary to compile and test the TypeShape library.

(repo-wide) · high confidence

Introduce staged expression helpers and subtype shape utilities

The library now provides a new set of tools for working with F\# quotations (expressions) and type relationships. In \StagingExtensions.fs\, a \TypeShape.Core.StagingExtensions\ module is added, exposing functions like \Expr.bind\, \Expr.lam\, \Expr.unlambda\, and \Expr.unlet\ to manipulate and simplify expression trees. Additionally, \SubtypeExtensions.fs\ introduces \Shape.tryCreateSubtypeShape\ and related active patterns to match types against base types or interfaces. These changes expand the library's capabilities for code generation and runtime type analysis.

src/TypeShape · high confidence

Introduces C\# support for generic subtype relationships

A new file, ShapeSubtype.cs, is added to the TypeShape.CSharp library, providing C\# implementations for generic subtype relationships that were previously difficult to express in F\#. This includes a SubtypeWitness class to encapsulate subtype relationships, along with ISubtypeVisitor and ISubtypeWitnessVisitor interfaces to support visiting these relationships. The implementation allows for safe and unsafe downcasting and upcasting between base and subtype types. Additionally, the library now references Microsoft.SourceLink.GitHub to enable source link support.

src/TypeShape.CSharp · high confidence

Test coverage

Add performance benchmarks for core TypeShape operations; Added C\# record test fixtures; Added comprehensive test coverage for TypeShape's core type system and cloning capabilities.

Dependencies

Upgrade to .NET 8 and modernize build infrastructure

The project has been upgraded to target .NET 8 for all test, benchmark, and sample projects, while the core library and C\# interop layer continue to target .NET Standard 2.0 and .NET Core 3.1. This update includes a comprehensive refresh of the dependency graph, introducing FSharp.Core 8.0.100, xUnit 2.4.2, FsCheck 3.0.0-alpha4, and BenchmarkDotNet 0.13.10, alongside the adoption of the .NET 8 SDK for the test and benchmarking infrastructure.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 53 → 52 (-0.4)
  • Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 89 → 69 (-19.9)
  • Architecture 97 → 97 (+0.0)
  • Maturity 38 → 38 (+0.0)
  • Readiness 55 → 55 (+0.0)
  • Security 65 → 77 (+12.1)

Resolved (39)

  • Dependency hygiene not measured — no packages were read
  • Duplicated block (10 lines × 2) (samples/TypeShape.Samples/HKT/JsonSerializer.fs)
  • Duplicated block (10 lines × 2) (samples/TypeShape.Samples/HKT/JsonSerializer.fs)
  • Duplicated block (10 lines × 2) (samples/TypeShape.Samples/equality-staged.fs)
  • Duplicated block (11 lines × 2) (samples/TypeShape.Samples/equality-comparer.fs)
  • Duplicated block (12 lines × 2) (samples/TypeShape.Samples/HKT/Pickler.fs)
  • Duplicated block (5 lines × 2) (samples/TypeShape.Samples/expr.fs)
  • Duplicated block (5 lines × 2) (samples/TypeShape.Samples/jsonconverter.fs)
  • Duplicated block (5 lines × 2) (samples/TypeShape.Samples/lens.fs)
  • Duplicated block (5 lines × 2) (samples/TypeShape.Samples/random.fs)
  • Duplicated block (6 lines × 2) (samples/TypeShape.Samples/HKT/JsonSerializer.fs)
  • Duplicated block (7 lines × 2) (samples/TypeShape.Samples/HKT/JsonSerializer.fs)
  • Duplicated block (8 lines × 2) (samples/TypeShape.Samples/HKT/JsonSerializer.fs)
  • Duplicated block (8 lines × 2) (samples/TypeShape.Samples/HKT/JsonSerializer.fs)
  • Duplicated block (8 lines × 3) (samples/TypeShape.Samples/HKT/Pickler.fs)
  • Duplicated block (9 lines × 2) (samples/TypeShape.Samples/HKT/CborSerializer.fs)
  • Duplicated block (9 lines × 2) (samples/TypeShape.Samples/HKT/CborSerializer.fs)
  • Duplicated block (9 lines × 2) (samples/TypeShape.Samples/HKT/CborSerializer.fs)
  • Duplicated block (9 lines × 2) (samples/TypeShape.Samples/HKT/JsonSerializer.fs)
  • High CVE: System.Net.Http 4.3.0
  • …and 19 more

New (36)

  • Documentation: no installation or build instructions (README.md)
  • Documentation: no usage examples (README.md)
  • Duplicated block (10 lines × 2) (src/TypeShape/TypeShape.fs)
  • Duplicated block (10 lines × 3) (samples/TypeShape.Samples/HKT/CborSerializer.fs)
  • Duplicated block (11 lines × 2) (samples/TypeShape.Samples/HKT/CborSerializer.fs)
  • Duplicated block (11 lines × 2) (samples/TypeShape.Samples/HKT/JsonSerializer.fs)
  • Duplicated block (14 lines × 2) (samples/TypeShape.Samples/HKT/JsonSerializer.fs)
  • Duplicated block (17 lines × 2) (samples/TypeShape.Samples/HKT/CborSerializer.fs)
  • Duplicated block (19 lines × 2) (samples/TypeShape.Samples/HKT/Pickler.fs)
  • Duplicated block (5 lines × 2) (samples/TypeShape.Samples/expr.fs)
  • Duplicated block (5 lines × 2) (samples/TypeShape.Samples/random.fs)
  • Duplicated block (5 lines × 3) (samples/TypeShape.Samples/HKT/CborSerializer.fs)
  • Duplicated block (5 lines × 3) (src/TypeShape/Applications/Clone.fs)
  • Duplicated block (5 lines × 4) (src/TypeShape/HKT/Folding.fs)
  • Duplicated block (6 lines × 2) (samples/TypeShape.Samples/HKT/JsonSerializer.fs)
  • Duplicated block (6 lines × 2) (src/TypeShape/TypeShape.fs)
  • Duplicated block (7 lines × 2) (src/TypeShape/TypeShape.fs)
  • Duplicated block (8 lines × 2) (samples/TypeShape.Samples/equality-staged.fs)
  • Duplicated block (8 lines × 3) (samples/TypeShape.Samples/HKT/Pickler.fs)
  • Duplicated block (8 lines × 3) (samples/TypeShape.Samples/HKT/Pickler.fs)
  • …and 16 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

eiriktsarpalis/TypeShape was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 24 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 7c982924e1800bc4a6961eed8f94e66f855b5ac9 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-923689c465cf.