Skip to content

Instantly share code, notes, and snippets.

@missingfaktor
Created August 18, 2011 05:31
Show Gist options
  • Save missingfaktor/1153355 to your computer and use it in GitHub Desktop.
Save missingfaktor/1153355 to your computer and use it in GitHub Desktop.
∅ from Scalaz
scala> import scalaz._
import scalaz._
scala> import Scalaz._
import Scalaz._
scala> ∅[Boolean]
res0: Boolean = false
scala> ∅[Int]
res1: Int = 0
scala> ∅[String]
res2: String = ""
scala> ∅[Seq[Int]]
res3: Seq[Int] = Vector()
scala> :paste
// Entering paste mode (ctrl-D to finish)
case class Complex(real: Double, imag: Double)
object Complex {
implicit val Zero = zero(Complex(0.0, 0.0))
}
// Exiting paste mode, now interpreting.
defined class Complex
defined module Complex
scala> ∅[Complex]
res4: Complex = Complex(0.0,0.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment