Skip to content
Snippets Groups Projects
Commit 3158f2c3 authored by Mikaël Mayer's avatar Mikaël Mayer
Browse files

Added Either[A, B] in the leon Library

parent 33b1e954
No related branches found
No related tags found
No related merge requests found
/* 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment