Re: Why does for(x <- c; y = ...) yield {...} become c.map(x => (x, ...)).map((x,y) => {...})
Naftoli Gugenheim <[email protected]>
| Newsgroups | gmane.comp.lang.scala |
|---|---|
| Message-ID | <CANpg8PBsfhv_nYj4RKBCmU28xyFqB9-byxz3Uitfr-WVJ+DeHw@mail.gmail.com> |
On the other hand, the more "dumb" the desugaring, the more variability it provides (for libraries that want to break monad laws etc.). On Sat, Jan 24, 2015, 7:35 PM Lex Spoon <[email protected]> wrote: > Another approach to the question is to try and fuse together .map().map() > into a single call to map(). Taking that approach, the desugaring of for() > could remain nicely simple. > > It's not a trivial problem, although it simplifies the problem to only > handle types that are in the standard library. > > On a related note, it would be really good if things like map() and > foreach() got inlined when called on a type that's in the standard library. > I know it feels like cheating, but it should make the most commonly written > Scala code run much faster. > > Lex > > > -- > You received this message because you are subscribed to the Google Groups > "scala-language" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "scala-language" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.