|
Scala example source code file (tcpoly_overloaded.scala)
The Scala tcpoly_overloaded.scala source codetrait Monad[T <: Bound[T], MyType[x <: Bound[x]], Bound[_]] { def flatMap[S <: RBound[S], RContainer[x <: RBound[x]], RBound[_], Result[x <: RBound[x]] <: Monad[x, RContainer, RBound]] (f: T => Result[S]): Result[S] def flatMap[S <: RBound[S], RContainer[x <: RBound[x]], RBound[_], Result[x <: RBound[x]] <: Monad[x, RContainer, RBound]] (f: T => Result[S], foo: String): Result[S] def flatMap[S <: Bound[S]] (f: T => MyType[S], foo: Int): MyType[S] } trait Test { def moo: MList[Int] class MList[T](el: T) extends Monad[T, List, Any] { def flatMap[S <: RBound[S], RContainer[x <: RBound[x]], RBound[_], Result[x <: RBound[x]] <: Monad[x, RContainer, RBound]] (f: T => Result[S]): Result[S] = error("foo") def flatMap[S <: RBound[S], RContainer[x <: RBound[x]], RBound[_], Result[x <: RBound[x]] <: Monad[x, RContainer, RBound]] (f: T => Result[S], foo: String): Result[S] = error("foo") def flatMap[S] (f: T => List[S], foo: Int): List[S] = error("foo") } val l: MList[String] = moo.flatMap[String, List, Any, MList]((x: Int) => new MList("String")) } Other Scala examples (source code examples)Here is a short list of links related to this Scala tcpoly_overloaded.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.