Re: Re: Scala - a Roadmap
Shelby <[email protected]>
| Newsgroups | gmane.comp.lang.scala |
|---|---|
| Message-ID | <[email protected]> |
Thank you. I do not understand what the syntax "functor =>" means in that
context?
Also how can abstract type members express Liskov Substitution Principle
variance?
http://stackoverflow.com/questions/5351248/type-members-and-covariance
On Monday, June 15, 2015 at 3:25:08 PM UTC+8, martin wrote:
>
> That would lose information. I believe you have to write it like this:
>
> trait Functor { functor =>
> type T
> type Subtype <: Functor { type T = functor.T }
> def map[R] : (T => R) => Subtype { type T = R }
> }
>
> To avoid misunderstanding (because I found many people do
> misunderstand this point): That would be a compiler expansion; you
> will usually still write the original parameterized version:
>
> > trait Functor[T, Subtype[T] <: Functor[T, Subtype[T]] {
> > def map : (T => R) => Subtype[R]
> > }
> >
>
> Cheers
>
> - Martin
>
--
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.