2 ms·
Immutable data and pure functions aren't as big as an obstacle as you might think. Uniqueness types allow you to use immutable variables and still directly mod
by eru 7y ago
Immutable data and pure functions aren't as big as an obstacle as you might think.
Uniqueness types allow you to use immutable variables and still directly model side effects and state changes. Arguably better than mutable variables do so.
(Haskell is not a good language for that kind of control. Though you could make a language that looks quite a lot like Haskell that fits. And people have done so.)
- didibus 7y agoIsn't uniqueness typing just a more restrictive form to Rust's linear types? And since Rust itself is often forced to rely on unsafe blocks for programming tasks (as opposed to computing tasks), then wouldn't that be true of a language with uniqueness types as well? Also, I'm guessing you mean Clean or Miranda? Any idea why they aren't more popular than Haskell? Or why Haskell doesn't adopt uniqueness typing?
- eru 7y agoLinear types and uniqueness typing are so close together that people often mix them up. Yes, that's basically what I am talking about. For general usage monads are much easier to deal with than Clean's "pass around the world" system. (I only used Clean for a bit, but haven't used Miranda, yet.) However, linear types for Haskell have been in the works for some time. See eg https://www.reddit.com/r/haskell/comments/dpr276/what_is_the_status_of_ghc_linear_types/ https://www.reddit.com/r/haskell/comments/dpr276/what_is_the... (Similarly, GHC now support strict Haskell, too, on a per module basis.) Uniqueness typing shines when you want to split up your 'real-world' object, so you can eg manipulate individual memory cells or ports etc independently. Rust goes into unsafe mode for multiple reasons. You could eliminate most of those, if you were willing to take the complexity of dependent types. Ie more or less that means the programmer taking on a greater burden of proving code to be safe to the compiler; instead of relying on Rust's more automatic but conservative system.