Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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>



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: