These are chat archives for rust-lang/rust

17th
Mar 2018
Danny Angelo Carminati Grein
@fungos
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
@epage
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
@bioball
Mar 17 2018 19:56
is there the equivalent of haskell's do notation in rust?
Denis Lisov
@tanriol
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
@bioball
Mar 17 2018 19:59
:(
Denis Lisov
@tanriol
Mar 17 2018 19:59
What's it that you're trying to do?
Daniel Chao
@bioball
Mar 17 2018 19:59
but monads are so embedded into the language
chain a bunch of methods that return Result
Denis Lisov
@tanriol
Mar 17 2018 20:02
Sorry, I'm not familiar with Haskell and still don't quite grasp what a monad is :-)
Dylan DPC
@Dylan-DPC
Mar 17 2018 20:25
ouch
bspeice
@bspeice
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?