These are chat archives for rust-lang/rust

Mar 2018
Danny Angelo Carminati Grein
Mar 17 2018 01:21
@epage Ok, but wasn't the idea of Failure to be seamless with Result<Error> ? I thought the idea of #derive(fail) and failure::Error were to do this. Seriously thought.. it is just getting more confusing this stuff, Result Error was good enough :S
Ed Page
Mar 17 2018 17:10

@fungos The problem is that a library can't solve the problem of implicitly converting your custom type to an failure::Error. What it can and does do is support?, bail!(context);, and throw!(fail); for working with Result<failure::Error>.

I still feel like failure has value over the existing trait Error ecosystem:

  • no_std and other trait fixes
  • Supporting cause in the trait.
  • failure_derive is a much better way of creating errors than error-chain
  • Error + Context is a nice way to do quick and dirty error reporting and chaining

But yes, I feel like some renaming, reorganizing, filling in a couple holes, and some improved docs would make the experience more straight forward / less confusing.

Daniel Chao
Mar 17 2018 19:56
is there the equivalent of haskell's do notation in rust?
Denis Lisov
Mar 17 2018 19:58
@bioball AFAIK, no, there is no equivalent notation (and I've read somewhere that it would be problematic to introduce).
Daniel Chao
Mar 17 2018 19:59
Denis Lisov
Mar 17 2018 19:59
What's it that you're trying to do?
Daniel Chao
Mar 17 2018 19:59
but monads are so embedded into the language
chain a bunch of methods that return Result
Denis Lisov
Mar 17 2018 20:02
Sorry, I'm not familiar with Haskell and still don't quite grasp what a monad is :-)
Dylan DPC
Mar 17 2018 20:25
Mar 17 2018 22:38
Is there a way to figure out what directory Cargo uses as the root folder to check out Git dependencies into?