org.scalatra.util.NotNothing.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scalatra_2.10 Show documentation
Show all versions of scalatra_2.10 Show documentation
The core Scalatra framework
The newest version!
package org.scalatra.util
/**
* Nice trick from Miles Sabin using ambiguity in implicit resolution to disallow Nothing
*/
sealed trait NotNothing[A] {
type B
}
object NotNothing {
implicit val nothing: NotNothing[Nothing] = new NotNothing[Nothing] { type B = Unit }
implicit def notNothing[A]: NotNothing[A] = new NotNothing[A] { type B = A }
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy