What I did, I decided not to pass the parameter to trait Functor. It's inside, and it is the 0th dimension component of Functor; the second one is declared too.
It's a little bit awkward with Scala types, I'd be thankful if someone could come up with a better suggestion than
Now this looks way more categorical.
It's a little bit awkward with Scala types, I'd be thankful if someone could come up with a better suggestion than
asInstanceOf.Now this looks way more categorical.
trait Functor {
type f0[_]
def f1[A,B](f:A=>B): f0[A] => f0[B]
}
object ListFunctor extends Functor {
type f0[_] = List[_]
def f1[A,B](f:A=>B)= (as:f0[A]) => as.asInstanceOf[List[A]].map(f)
}