
When Rust is safer than Haskell - sidcool
https://www.fpcomplete.com/blog/when-rust-is-safer-than-haskell
======
SomeHacker44
As an almost two decade Haskeller who really wants to try Rust in a
performance and security sensitive production context, I really appreciated
this article. However, it might have actually pushed me more toward Haskell. I
have decades of experience in C-derived languages and the syntax is just not
my favorite, compared to Haskell and LISPs.

Of course, given the 3,619,661 compiler extensions in GHC, whats another that
would enable this sort of lifetime/reference tracking (and endless chasing of
type errors that all Haskellers are used to anyway) functionality to be pushed
into the type system? I almost cannot imagine it has not been done.

Great article!

~~~
twic
> course, given the 3,619,661 compiler extensions in GHC, whats another that
> would enable this sort of lifetime/reference tracking (and endless chasing
> of type errors that all Haskellers are used to anyway) functionality to be
> pushed into the type system?

Rust-style ownership semantics exert strong design pressure on libraries,
including the standard library. Rust's ecosystem has evolved under that
pressure; Haskell's has not. I have no doubt at all that Haskell could be
extended with affine types (never go in against a Haskeller when a conference
paper is on the line!), but once you'd done that, you wouldn't be able to use
any existing libraries.

Which, given the state of the Haskell ecosystem, might be a bit of a relief.

~~~
garmaine
Actually no, Linear Haskell works in a fully backwards compatible way with
existing libraries. I suggest checking it out.

~~~
twic
What would you suggest i read? I have got the 'Retrofitting Linear Types', and
a quick scan suggests it doesn't give concrete examples of that backwards
compatibility (although it probably follows from the proofs, which i have not
digested yet!). Is there something more practical?

~~~
garmaine
There's a bit more said about it here:

[https://arxiv.org/pdf/1710.09756.pdf](https://arxiv.org/pdf/1710.09756.pdf)

------
jononor
I think the most interesting this here is the multiple steps of 'fighting with
the compiler', being illustrated on a case we know up front is actually a bad
idea. Most of the time we need to go through all those steps to realize that
oh, this actually didn't make much sense in the first place. Which doesn't
always feel that rewarding...

------
zZorgz
In my experience a while back when writing socket / IO code, I thought Rust
was safer because standard library functions in Haskell (and other languages I
experimented around with) could throw unchecked exceptions/errors.

Never mind about data races :).

------
choeger
Gorgeous article. And it shows that regardless how strong rust is, it does not
hide the complexity of the subject. Very nice.

