A Scala Option with both implicit and explicit None.


Build Status Maven Central Scaladoc

Tristate[A] is three-valued variant of Option[A] distinguishing between Present[A](a: A), Absent, and Unspecified.

Name Description Scaladoc
tristate-core Main library API
tristate-play Play JSON Reads/Writes API
tristate-cats Cats Typeclasses API
tristate-scalaz Scalaz Typeclasses API


Add the following to your sbt build:

libraryDependencies += "org.davidbild" %% "tristate-core" % "0.4.0"

To support de/serialization using Play JSON, also add:

libraryDependencies += "org.davidbild" %% "tristate-play" % "0.4.0"

For Scalaz typeclass instances (Functor, Monad, etc.), also add:

libraryDependencies += "org.davidbild" %% "tristate-scalaz" % "0.4.0"

For Cats typeclass instances (Functor, Monad, etc.), also add:

libraryDependencies += "org.davidbild" %% "tristate-cats" % "0.4.0"




import org.davidbild.tristate.Tristate

// For optional Play JSON support
import org.davidbild.tristate.contrib.play._

// For optional Scalaz typeclass support
import org.davidbild.tristate.contrib.scalaz._

// For optional Cats typeclass support
import org.davidbild.tristate.contrib.cats._



Please submit bugs, questions, suggestions, or (ideally) contributions as issues and pull requests on Github.


David R. Bild https://www.davidbild.org


Copyright 2016 David R. Bild

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License from the LICENSE.txt file or at


Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.