Skip to content

Instantly share code, notes, and snippets.

@etorreborre
Created July 24, 2010 01:17
Show Gist options
  • Save etorreborre/488281 to your computer and use it in GitHub Desktop.
Save etorreborre/488281 to your computer and use it in GitHub Desktop.
/**
* A quick debugging tip
*/
/**
* If you have lots of definitions using the same type parameter names, like 'S'
*/
def beEmpty[S <: HasIsEmpty]: Matcher[S] = new EmptyMatcher()
def compose[S] (f: S => T) = new Matcher[S] { ... }
/**
* You may get cryptic compiler messages: "could not find implicit value for parameter c: (B) => S"
*
* Just change (temporarily) the type variable to:
*/
def beEmpty[SHasIsEmpty <: HasIsEmpty]: Matcher[SHasIsEmpty] = new EmptyMatcher()
/**
* And things start getting clearer!
*
* "could not find implicit value for parameter c: (B) => SHasIsEmpty"
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment