fastsum

A fast open-union type suitable for 100+ contained alternatives

https://github.com/patrickt/fastsum#readme

Latest on Hackage:0.2.0.0@rev:1

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

BSD-3-Clause licensed by Rob Rix, Josh Vera, Allele Dev, Patrick Thomson
Maintained by [email protected]

This package provides Data.Sum, an open-union type, similar to the Union type that powers the implementation of Oleg Kiselyov's extensible-effects library.

Unlike most open-union implementations, this type is very fast to compile, even when the type-level list of alternatives contains hundreds of entries. Membership queries are constant-time, compiling to a single type-level natural lookup in a closed type family, unlike the traditional encoding of Union, which relies on recursive typeclass lookups. As such, this type lends itself to representing abstract syntax trees or other rich data structures.

This project is safe to use in production. Any performance problems at compile-time or runtime should be filed as bugs.