Script and code: catalin-tech.com/haskell-rust/ Errata: At 11:40 - the macro doesn't have the correct syntax, and the derived trait has to be Debug - Display is not derivable. The following print macro also needs a format string.
I raised my eyebrows at 5:40 when I heard that "unsafe" is the rust way to "know what parts of the code can cause side effects". I was expecting Result::and_then to popup when talking about IO and monads! Also Option::map/and_then ,which share far more similarities than "unsafe" IMHO. (I would have compare rust's unsafe to haskell's "unsafePerformIO").
Hi - I didn't say that, though I get how a viewer could make the connection. Thanks for pointing this out. I was just saying that it's a similar concept o creating a barrier around operations that are more dangerous. I wanted to mostly compare philosophical approaches to language design, rather than comparing Haskell's monad capability with the monad types we have available in Rust.
Rust just took some old ideas from Haskell and others and found a way to write code without GC, but the syntax of Rust is ugly and terrible, coming from Haskell, Rust code looks like C++ mix with some hipster language, hard to read. Haskells main issue is bad documentation, tooling(2 gb to install the compiler..) and no backward compatibility, but Haskell's syntax is amazing, although language extensions in Haskell are annoying.
Would agree - I think it's hard to come up with a way of simplifying Rust syntax while keeping the advantages it currently offers. I'm personally ok with dealing with awkward syntax in some areas in order to have the benefits, but I get why people wouldn't want to deal with it. Haskell is indeed elegant and beautiful (though there are certain design choices that I very much dislike), but using it to build something that you actually want to use is not the best experience - though it's getting better. Compared to Rust's tooling, a lot of languages don't look that good, in any case.
Well spotted. Just to make the story more interesting - Rust also took old ideas from Simula I, with automatic memory management via the ownership model ... which is effectively a form of automatic garbage collection. That was all back in the late 1960s, where CPUs were not as fast, and allocate / free overhead was quite a bit higher. So the general solution to that performance problem was to delay and batch up garbage collection, which then led to the "mark and sweep'" style of GCs that we are familiar with today. Ironically, mark and sweep GC is now considered harmful to performance :) End of the day ... manual memory management has always been the performance king, and its always going to be the performance king. It's just got a few obvious foot guns. I much prefer Zig's approach to addressing those obvious foot guns, rather than attempt to invent a whole new way of restricting programmers that just gets in the way. I don't find using Rust to be enjoyable in the slightest, and that has nothing to do with the syntax. I would rather peel potatoes for a living
You could say that OCaml is closer to Rust because it has some imperative features, while Haskell has none. (Though this makes it closer to any imperative language - which I find very uninteresting to discuss). Looking at the way the type system is designed, I find that Rust borrows more from Haskell than Ocaml (see traits / typeclasses vs modules in OCaml.
Script and code: catalin-tech.com/haskell-rust/
Errata:
At 11:40 - the macro doesn't have the correct syntax, and the derived trait has to be Debug - Display is not derivable. The following print macro also needs a format string.
Loved, the video, concepts are explained fairly clearly, I would love to see more Haskell content.
Noted - Glad it was useful, thank you so much!
underrated channel. 🙏🙏🙏
Thank you so much!
I raised my eyebrows at 5:40 when I heard that "unsafe" is the rust way to "know what parts of the code can cause side effects". I was expecting Result::and_then to popup when talking about IO and monads! Also Option::map/and_then ,which share far more similarities than "unsafe" IMHO. (I would have compare rust's unsafe to haskell's "unsafePerformIO").
Hi - I didn't say that, though I get how a viewer could make the connection. Thanks for pointing this out. I was just saying that it's a similar concept o creating a barrier around operations that are more dangerous. I wanted to mostly compare philosophical approaches to language design, rather than comparing Haskell's monad capability with the monad types we have available in Rust.
Please make a video about haskell templates and Rust macros
Thanks for the input!
Content? Fantastic, learned something and had things cleared up in my head.
Prosody? Needs work. Looking forward to more!
Glad you found it useful! Thanks for the feedback - I'm working on improving the way I talk while recording.
Magnificent video
You're too kind! Glad you enjoyed it!
Rust just took some old ideas from Haskell and others and found a way to write code without GC, but the syntax of Rust is ugly and terrible, coming from Haskell, Rust code looks like C++ mix with some hipster language, hard to read. Haskells main issue is bad documentation, tooling(2 gb to install the compiler..) and no backward compatibility, but Haskell's syntax is amazing, although language extensions in Haskell are annoying.
Would agree - I think it's hard to come up with a way of simplifying Rust syntax while keeping the advantages it currently offers. I'm personally ok with dealing with awkward syntax in some areas in order to have the benefits, but I get why people wouldn't want to deal with it.
Haskell is indeed elegant and beautiful (though there are certain design choices that I very much dislike), but using it to build something that you actually want to use is not the best experience - though it's getting better. Compared to Rust's tooling, a lot of languages don't look that good, in any case.
Well spotted. Just to make the story more interesting - Rust also took old ideas from Simula I, with automatic memory management via the ownership model ... which is effectively a form of automatic garbage collection.
That was all back in the late 1960s, where CPUs were not as fast, and allocate / free overhead was quite a bit higher. So the general solution to that performance problem was to delay and batch up garbage collection, which then led to the "mark and sweep'" style of GCs that we are familiar with today.
Ironically, mark and sweep GC is now considered harmful to performance :)
End of the day ... manual memory management has always been the performance king, and its always going to be the performance king. It's just got a few obvious foot guns.
I much prefer Zig's approach to addressing those obvious foot guns, rather than attempt to invent a whole new way of restricting programmers that just gets in the way. I don't find using Rust to be enjoyable in the slightest, and that has nothing to do with the syntax. I would rather peel potatoes for a living
Honestly, making Rust's syntax more like Haskell is one of the very few things that would make me like the language even more than I already do.
Re-upload?
Yes, there was a major mistake for the monad explanation in the first version, so I updated, rerendered and re-uploaded.
The whole unsafe side trip is highly misleading to anyone who doesn't know Rust, who might think you have to use unsafe just to do I/O.
id say more like scala really...
Perhaps Ocaml is more accurate :)
You could say that OCaml is closer to Rust because it has some imperative features, while Haskell has none. (Though this makes it closer to any imperative language - which I find very uninteresting to discuss). Looking at the way the type system is designed, I find that Rust borrows more from Haskell than Ocaml (see traits / typeclasses vs modules in OCaml.