These are chat archives for rust-lang/rust

11th
Jun 2016
James Sully
@sullyj3
Jun 11 2016 15:33
So I'm reading through https://doc.rust-lang.org/book/error-handling.html , and I really don't feel like I understand map. In the examples it seems like it's applying a function only to a single value, (if it exists) contained in an Option<T>. This seems really different to the semantics of map in other languages (eg haskell, python), in which it will apply a function to a list. Is there a reason for the difference?
Alexander Ronald Altman
@pthariensflame
Jun 11 2016 16:53
The map method in Rust tends to correspond with the general fmap of Haskell, rather than the list-specific map.
(Although there's no trait for it like Functor—yet.)
James Sully
@sullyj3
Jun 11 2016 16:55
Thank you!