Hacker News new | ask | show | jobs
by omeze 759 days ago
If you have to create new types then why can’t this just be done by existing type systems, eg in Typescript:

Linear<T, S> = { state: S, data: T }

type CompletedTxState = ‘commit’ | ‘rollback’

Then eg for db transactions:

const commit = (t: Transaction, dbconn: DBConn): Linear<Transaction, CompletedTxState>