Re: Why is the PECS principle not applied to Function1?
I'm pretty sure that compose is a method on A => B taking an argument of
the type X => A and return a value of the type X => B, hence
compose/map: (A => B) => (X => A) => (X => B).
On 01/07/12 00:51, Chris Marshall wrote:
> You also got compose and andThen the wrong way round. g(f(x)) is (f andThen g)(x) or (g compose f)(x). Hence
> - andThen is "map" - compose is "contra-map"
> Chris
>> Date: Sat, 30 Jun 2012 21:02:02 +1000
>> From: tonymorris@...
>> To: scala-user@...
>> Subject: Re: [scala-user] Why is the PECS principle not applied to Function1?
>>
>> On 30/06/12 20:49, Tony Morris wrote:
>>> As for contravariance, we have a very similar question. First, what is a
>>> contravariant functor? It is any functor giving rise to this operation:
>>> [A, B](A => B) => F[B] => F[B]
>> Sorry, typo.
>>
>> The correct signature for contravariance is:
>> [A, B](A => B) => F[B] => F[A]
>>
>> PS: I sometimes wonder if spell-correctors of the future will pick that
>> up, "you just wrote a function signature that is not very useful. Did
>> you mean to write this instead...?"
>>
>> --
>> Tony Morris
>> http://tmorris.net/
>>
(Continue reading)