Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Higher RAII, and the Seven Arcane Uses of Linear Types (verdagon.dev)
10 points by ingve on May 14, 2024 | hide | past | favorite | 1 comment


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: