Created
March 21, 2016 10:31
-
-
Save milessabin/80abc629d3b7deb0ecc4 to your computer and use it in GitHub Desktop.
Idris's Dec in Scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed trait Dec[+T] | |
final case class Yes[T](t: T) extends Dec[T] | |
final case object No extends Dec[Nothing] | |
object Dec extends Dec0 { | |
implicit def yes[T](implicit t: T): Dec[T] = Yes(t) | |
} | |
trait Dec0 { | |
implicit def no[T]: Dec[T] = No | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment