Skip to content

Instantly share code, notes, and snippets.

@max-l
Created December 3, 2011 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save max-l/1427587 to your computer and use it in GitHub Desktop.
Save max-l/1427587 to your computer and use it in GitHub Desktop.
import java.util.Date
trait TDate
trait TT[A1,T1]
trait TTFactory[F,G] {
def create(f: F) : TT[F,G]
def sample: F
}
object Impls {
// If the c1 is declared before c2, it compiles fine
implicit def c2(s: Date) = c1.create(s)
implicit val c1 = new TTFactory[Date,TDate] {
def create(v: Date): TT[Date,TDate] = sys.error("")
def sample = new Date
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment