sum-types icon indicating copy to clipboard operation
sum-types copied to clipboard

Safe, ergonomic, non-generic sum types in TypeScript.

Results 13 sum-types issues
Sort by recently updated
recently updated
newest added

This can probably be merged into one of the other issues regarding stringification/logging. The value is in React context and dev tools truncates it.

Slack discussion for reference: https://crewlabs.slack.com/archives/CFZE45NTW/p1631709631008600 With Unionize it was very easy to rename a tag in the union—TS would propagate the change to all constructors, match functions and type definitions....

Motivational example: ```ts type Weather = Sum.Member | Sum.Member const Weather = Sum.create() declare const x: Weather declare const someCond: boolean const shouldDoSomething1 = someCond && pipe(x, Weather.match({ Sun: constant(true),...

Following #50 sums should be comparable with `toEqual`, however when an expectation fails the diff is a bit rubbish for nullary sums, stating "serializes to the same string". I believe...

I'm not sure if this is possible. Currently nullary members appear as functions. It's difficult to view the contents (tag and value). `console.dir` helps because it allows us to inspect...

Including: - [x] Usage overview for anyone already familiar with the basic idea of sum types - [ ] Guide for everyone else - [ ] Deep dive on why...

A tracking issue for if this ever becomes viable. In the meantime we should document the challenges faced.

A limitation of our object-based matching API is that an equivalent to the following isn't possible: ```hs case x of A, B -> etc C -> etc ``` ```ts switch...

And then the same for the bindings libs.

It's a common use case to want to enumerate members of a sum type. This probably warrants inclusion in this library, but in what shape? In Haskell, for all-nullary constructors,...