They are almost equivalent, as it is said in the comment.
Say you have a class trait Super[F[_]] {}
, and you want to implement it where F[x] = Either[Int, x]
You could write:
type IntOrA[A] = Either[Int, A]
class B extends Super[IntOrA] {}
But if you want a one liner, you could write:
class B extends Super[({type L[A] = Either[Int, A]})#L] {}
Or with kind-projector you could write it like:
class B extends Super[λ(A => Either[Int, A])] {}
or even:
class B extends Super[Either[Int, ?]] {}
there is no other difference than making it a one line and having this type anonymous.
#L
at the end? – Dunkirk#L
accesses the type member that was just created inside – Honour#
? – Dunkirk#
is type projection. It allows you to access any path dependent type, which L is and treat it as not being path dependent, i.e. by path dependent types inner types are not equal when accessed with.
, but are equal when accessed with#
. See more #9443504 – Ind