News for hackers. Stuff that matters.
Re:I would like a job writing Haskell by Kototama on Tuesday February 08, 2022 @09:48AM (#30259007)
I'm not that familiar with Rust at the moment, could you expand?
Re:I would like a job writing Haskell by ReleaseCandidat on Tuesday February 08, 2022 @10:18AM (#30259360)
To use traits like you would type classes in Haskell, for example to define functors or monads in a general way, you need higher kinded types. Which can kind[oh, what a pun] of be implemented in Rust.

   So yes! You can use higher kinded types in rust. Whether you should I will
   leave up to you. But it certainly doesn't seem like a very attractive option 
   for most projects considering the syntactic noise of the implementation, a 
   typechecker that gets often confused and requires help, as well as error 
   messages that don't make much sense. Especially the last is a shame since 
   extremely helpful error messages is what rust is known for, and I 
   wholeheartedly agree (under normal circumstances).
https://hugopeters.me/posts/14/

   Yes, But Why, Really?
   Because sometimes one just gets homesick for Haskell and wants to implement
   the Functor hierarchy. You'll find this in the higher-cat crate. It's not 
   really very suited for writing good Rust code, but it makes Haskell 
   programmers feel happy and it has a lot of funny words.
https://docs.rs/higher/latest/higher/

A proposal for an addition to Rust, to get generic monads and (Haskell-like) do-notation for them:

https://varkor.github.io/blog/2019/03/28/idiomatic-monads-in...

Re:I would like a job writing Haskell by benreesman on Tuesday February 08, 2022 @10:11AM (#30259277)
GP is referring to a Rust language feature called “traits” that is a quirky subset of a Haskell language feature called “type classes”.

Type classes are based on firmer theoretical footing (I think the original paper is called “Making Ad-Hoc Polymorphism Less Ad-Hoc”) and therefore run into fewer weird corner cases.

That’s not to say that Rust traits are “bad”, they’re useful and arguably cleaner than the C++ version of the idea (“concepts”), but a Haskell hacker writing Rust is liable to grumble now and again at the weird edge cases.