[rust-dev] Chaining Results and Options

2014-02-10 Thread Armin Ronacher
Hi, I was playing around with the new IO system a lot and got some very high level feedback on that. Currently the IoResult objects implement a few traits to pass through to the included success value and to dispatch method calls. That's nice but it means that from looking at the code you

Re: [rust-dev] Chaining Results and Options

2014-02-10 Thread Sergei Maximov
It looks very similar to Haskell's monadic bind operator (=) at first glance. 02/10/2014 10:40 PM, Armin Ronacher пишет: Hi, I was playing around with the new IO system a lot and got some very high level feedback on that. Currently the IoResult objects implement a few traits to pass through

Re: [rust-dev] Chaining Results and Options

2014-02-10 Thread Huon Wilson
It's actually Haskell's fmap, which we have in the form of .map for both Option[1] and Result[2], e.g. the proposed expr-method() is the same as expr.map(|x| x.method()) (which is still quite verbose). Monadic bind comes in the form of the .and_then methods (which both Option and Result

Re: [rust-dev] Chaining Results and Options

2014-02-10 Thread Huon Wilson
Ah, true enough. I think you were correct, and I misread the original email. `swap(mut map, mut and_then)` and fmap - monadic bind in my reponse. Huon On 10/02/14 23:00, Sergei Maximov wrote: I believe it depends on what return type `.method` has, but I got your point. 02/10/2014 10:50 PM,

Re: [rust-dev] Fwd: Problems building rust on OSX

2014-02-10 Thread Felix S. Klock II
Martin (cc'ing rust-dev)- I recommend you file a fresh bug with a transcript of your own build attempt. I infer you are pointing us to issue #11162 because of some similarity in the log output you see between that and your own build issue, but issue #11162 is fundamentally related to a

Re: [rust-dev] Chaining Results and Options

2014-02-10 Thread Armin Ronacher
Hi, On 10/02/2014 11:50, Huon Wilson wrote: It's actually Haskell's fmap, which we have in the form of .map for both Option[1] and Result[2], e.g. the proposed expr-method() is the same as expr.map(|x| x.method()) (which is still quite verbose). The return value of .method() is actually a

Re: [rust-dev] Fwd: Problems building rust on OSX

2014-02-10 Thread Martin Koch
Thanks, Felix. I came up with a simpler soution: brew install rust :) - That works just fine (at least I now have a running rust 0.9 compiler). /Martin On Mon, Feb 10, 2014 at 1:33 PM, Felix S. Klock II pnkfe...@mozilla.comwrote: Martin (cc'ing rust-dev)- I recommend you file a fresh bug

Re: [rust-dev] Chaining Results and Options

2014-02-10 Thread Ziad Hatahet
Isn't this proposal a subset of having `do` syntax like Haskell does? I thought that was being blocked on HKTs. -- Ziad On Mon, Feb 10, 2014 at 4:40 AM, Armin Ronacher armin.ronac...@active-4.com wrote: Hi, On 10/02/2014 11:50, Huon Wilson wrote: It's actually Haskell's fmap, which we

Re: [rust-dev] Chaining Results and Options

2014-02-10 Thread Sean McArthur
This could be handled by a macro. opt_method!(tmp, method) On Mon, Feb 10, 2014 at 12:04 PM, Ziad Hatahet hata...@gmail.com wrote: Isn't this proposal a subset of having `do` syntax like Haskell does? I thought that was being blocked on HKTs. -- Ziad On Mon, Feb 10, 2014 at 4:40 AM,

Re: [rust-dev] Chaining Results and Options

2014-02-10 Thread Armin Ronacher
Hi, Actually on that note I want to put more emphasis on this part: On 10/02/2014 11:40, Armin Ronacher wrote: Annoyingly enough this also means that the results need to be compatible which is still a problem. The example there would be an IO trait that is implemented by another system that