Skip to content

Instantly share code, notes, and snippets.

View sergey-scherbina's full-sized avatar

Scherbina Sergey sergey-scherbina

View GitHub Profile
//isValid = predicate/constraint
abstract class Type[T](val isValid : (T) => boolean)
{
//X is the reference type
final protected[Type] case class X[T] (val value : T) {
override def toString = Type.this.getClass.getSimpleName + "(" + value + ")"
}
//Type is the alias for X[T] that we expose to the outside world
type Type = X[T]