diff --git a/library/lang/Either.scala b/library/lang/Either.scala new file mode 100644 index 0000000000000000000000000000000000000000..9cc2ea4e9537b424cbce6963e2a4038f3480d01a --- /dev/null +++ b/library/lang/Either.scala @@ -0,0 +1,27 @@ +/* Copyright 2009-2015 EPFL, Lausanne */ + +package leon.lang + +import leon.annotation._ + +/** + * @author Viktor + */ +@library +sealed abstract class Either[A,B] { + def isLeft : Boolean + def isRight : Boolean + def swap : Either[B,A] +} +@library +case class Left[A,B](content: A) extends Either[A,B] { + def isLeft = true + def isRight = false + def swap = Right[B,A](content) +} +@library +case class Right[A,B](content: B) extends Either[A,B] { + def isLeft = false + def isRight = true + def swap = Left[B,A](content) +} \ No newline at end of file