deriving-ts is heavily inspired by morphic-ts and io-ts.
The primary goals for this library are:
- Easy addition of support for new types in application code
- Easy addition of new interpreters in application code
- Program declarations use minimal algebra required for the program
- Programs can provide interpreter specific inputs for zero or more interpreters per program
- Programs can be reasonably defined to support composition and manipulation of declarations
- Interpreter definitions cover minimal algebra supported by the interpreter
- Interpreters can accept or require interpreter specific inputs from programs
- Interpreters can be reasonably defined to support composition and manipulation of definitions
io-ts and morphic-ts provide a great set of functionality towards type-directed generic derivation of programs in typescript, both using a finally-encoded approach.
While final encoding seems to play nicely with the quirks and limitations of the typescript compiler, it can cause some friction with composition and re-use of programs written using the provided DSLs. Namely, because there is no reified value representing the definition of a program, special care must be taken to allow programs to be composed and manipulated in meaningful ways prior to their interpretation in their "target languages."
After hitting a wall in a considerable effort to solve for generic derivation using an initially-encoded approach, io-ts and morphic-ts provided great insight into the finally-encoded approach. A desire to preserve as much of the flexibility offered by an initial encoding as possible during the pivot has led to the architectural choices in this library.
Built from this starter