mirror of https://github.com/sbt/sbt.git
add Types.idFun to replace Predef.identity, replace a :== overload
idFun[T]: T => T instead of identity[T](t: T): T doesn't require a new class file when used as a function value replaced overloads of :== that assigned the Scoped reference on the right to the Scoped on the left with <<= scoped.identity
This commit is contained in:
parent
19ac4b51b2
commit
ed7721bb7d
|
|
@ -14,6 +14,7 @@ trait TypeFunctions
|
|||
final val left = new (Id ~> P1of2[Left, Nothing]#Flip) { def apply[T](t: T) = Left(t) }
|
||||
final val right = new (Id ~> P1of2[Right, Nothing]#Apply) { def apply[T](t: T) = Right(t) }
|
||||
final val some = new (Id ~> Some) { def apply[T](t: T) = Some(t) }
|
||||
final def idFun[T] = (t: T) => t
|
||||
|
||||
def nestCon[M[_], N[_], G[_]](f: M ~> N): (M ∙ G)#l ~> (N ∙ G)#l =
|
||||
f.asInstanceOf[(M ∙ G)#l ~> (N ∙ G)#l] // implemented with a cast to avoid extra object+method call. castless version:
|
||||
|
|
|
|||
Loading…
Reference in New Issue