This could be handled by a macro. opt_method!(tmp, method)

On Mon, Feb 10, 2014 at 12:04 PM, Ziad Hatahet <[email protected]> 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, Armin Ronacher <
> [email protected]> wrote:
>
>> 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 Result/Option so it would be
>> more similar to .and_then:
>>
>> foo->bar()
>>
>> // would be the same as
>>
>> foo.and_then(|x| x.bar());
>>
>>
>>
>> Regards,
>> Armin
>>
>> _______________________________________________
>> Rust-dev mailing list
>> [email protected]
>> https://mail.mozilla.org/listinfo/rust-dev
>>
>
>
> _______________________________________________
> Rust-dev mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/rust-dev
>
>
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to