Type Classes

Type Classes

Share this post

Type Classes
Type Classes
Correctness.scala

Correctness.scala

Chris Martin's avatar
Chris Martin
Oct 22, 2013
∙ Paid
1

Share this post

Type Classes
Type Classes
Correctness.scala
Share
trait Correctness {
  
  // Let’s talk about programs.
  type P
  
  // A specification is a predicate on a program.
  trait S { def apply (p: P): Boolean }
  
  // We say "p implements s" when a program meets a specification.
  def `p implements s` (p: P, s: S) = s (p)
  
  // We shorten this to "p is correct" when a specification is contextually impli…

Keep reading with a 7-day free trial

Subscribe to Type Classes to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Mission Valley Software LLC
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share