Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 389 Bytes

refinements.adoc

File metadata and controls

20 lines (14 loc) · 389 Bytes

Refined Types (refinements)

Refinements are very easy to explain as "subclassing without naming the subclass". So in source code it would look like this:

class Entity

trait Persister {
  def doPersist(e: Entity) = {
    e.persistForReal()
  }
}

// our refined instance (and type):
val refinedMockPersister = new Persister {
  override def doPersist(e: Entity) = ()
}