Skip to content

Type directed "typeclass" derivation in TypeScript

License

Notifications You must be signed in to change notification settings

beezee/deriving-ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deriving-ts

deriving-ts is heavily inspired by morphic-ts and io-ts.

Goals

The primary goals for this library are:

  1. Easy addition of support for new types in application code
  2. Easy addition of new interpreters in application code
  3. Program declarations use minimal algebra required for the program
  4. Programs can provide interpreter specific inputs for zero or more interpreters per program
  5. Programs can be reasonably defined to support composition and manipulation of declarations
  6. Interpreter definitions cover minimal algebra supported by the interpreter
  7. Interpreters can accept or require interpreter specific inputs from programs
  8. Interpreters can be reasonably defined to support composition and manipulation of definitions

Adding support for new types

Adding new interpreters

Declaring algebras for programs

Providing interpreter-specific inputs to programs

Composing and manipulating program declarations

Defining interpreters for algebras

Supporting and requiring interpreter specific inputs from programs

Composing and manipulating interpreter definitions

Background

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.

How to build TypeScript mono-repo project

CircleCI

Built from this starter

About

Type directed "typeclass" derivation in TypeScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published