Permalink
Browse files

Re-ordered for clarity

  • Loading branch information...
jqno committed Feb 19, 2012
1 parent f4a7e08 commit c789509d1e0d8470aca57f7ca2efa0d7c8404048
Showing with 7 additions and 7 deletions.
  1. +7 −7 src/main/scala/com/nummulus/boite/Box.scala
@@ -84,19 +84,13 @@ final case class Full[+A](value: A) extends Box[A] {
override def toList: List[A] = List(value)
}
-case object Empty extends BoiteVide
-
sealed abstract class BoiteVide extends Box[Nothing] {
def isEmpty = true
override def getOrElse[B >: Nothing](default: => B): B = default
}
-object Failure {
- def apply(message: String) = new Failure(message, Empty)
- def apply(throwable: Throwable) = new Failure(throwable.getMessage, Full(throwable))
- def apply(message: String, throwable: Throwable) = new Failure(message, Full(throwable))
-}
+case object Empty extends BoiteVide
sealed case class Failure(message: String, exception: Box[Throwable]) extends BoiteVide {
type A = Nothing
@@ -114,3 +108,9 @@ sealed case class Failure(message: String, exception: Box[Throwable]) extends Bo
override def hashCode: Int =
exception.hashCode + (if (message == null) 0 else 31 * message.hashCode)
}
+
+object Failure {
+ def apply(message: String) = new Failure(message, Empty)
+ def apply(throwable: Throwable) = new Failure(throwable.getMessage, Full(throwable))
+ def apply(message: String, throwable: Throwable) = new Failure(message, Full(throwable))
+}

0 comments on commit c789509

Please sign in to comment.