1

I have to solve this quinz but i can't find the correct answer.

trait Physics {
  implicit def air: Gaz,
  implicit def condense(implicit gaz: Gaz): Liquid,
  implicit def freeze(implicit liquid: Liquid): Solid

  implicitly[Solid]
}

Can you rewrite the last line with the inferred parameter explicitly written?

Hint: It should look like implicitly[Solid](...

Thank you so much!

Dmytro Mitin
  • 48,194
  • 3
  • 28
  • 66

1 Answers1

3

Here is a hint: first consider implicitly is just a method like any other

def implicitly[T](implicit e: T): T = e

Lets remove the keyword implicit such that

def implicitly[T](e: T): T = e

Given implicitly is just a method taking arguments, think about what would you have to do to make compiler happy and have method implicitly return a Solid?

Mario Galic
  • 47,285
  • 6
  • 56
  • 98