News for hackers. Stuff that matters.
Re:Idiomatic Monads in Rust by tempodox on Thursday April 04, 2019 @12:24PM (#19574153)
If taking monads to Rust takes such convoluted code, my conclusion would be that it probably isn't a good fit. Compared to this, Haskell is a breeze.
Re:Idiomatic Monads in Rust by nine_k on Thursday April 04, 2019 @02:24PM (#19575506)
One of the purposes of publishing such papers, as see it, is triggering responses with simpler, easier proposals. They may cover the important 90% of the original, doing away with the most complexity-inducing 10%.
Re:Idiomatic Monads in Rust by empath75 on Thursday April 04, 2019 @08:37PM (#19578539)
Implementing monads will be convoluted, using them is relatively easy. It wouldn’t change any of the existing code, but it would allow you to write a function like this:

fn double_inner<M: Monad<u64>>(m: M) -> M { m.bind(|x| M::unit(x * 2)) }

Which takes anything wrapping an integer and doubles it, whether it’s an option or result or iterator.

Re:Idiomatic Monads in Rust by uryga on Friday April 05, 2019 @08:32AM (#19581848)
not sure if this is the best example – `Functor` would be enough here
Re:Idiomatic Monads in Rust by empath75 on Friday April 05, 2019 @08:46AM (#19581950)
well, as neither exist currently it doesn't matter much does it?