Comment

Comment by chrisaycock

I first became fascinated by linear [1] and uniqueness [2] types with Clean [3], a purely functional language that handles state and IO without monads.

This Haskell extension uses linear types for resource safety and scoped effects [4]. For example, linear types can prevent use-after-free errors. Also, linear-typed arrays can perform in-place updates if there are no external pointers to the data.

Similar to linear types is the affine type, where a value is used at-most once. Rust's borrow checker is based on this notion, so that values are "moved" rather than "copied".

[1] https://en.wikipedia.org/wiki/Uniqueness_type

[2] https://en.wikipedia.org/wiki/Substructural_type_system

[3] https://clean.cs.ru.nl/Clean

[4] https://arxiv.org/abs/1710.09756

parent chrisaycock 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton