Higher RAII, and the Seven Arcane Uses of Linear Types(verdagon.dev)10 points·by ingve·vor 2 Jahren·1 commentsverdagon.devHigher RAII, and the Seven Arcane Uses of Linear Typeshttps://verdagon.dev/blog/higher-raii-uses-linear-types1 commentsPost comment[–]omeze·vor 2 JahrenreplyIf 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>
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>