All Downloads are FREE. Search and download functionalities are using the official Maven repository.

au.id.tmm.bfect.ExitCase.scala Maven / Gradle / Ivy

/**
  *    Copyright 2019 Timothy McCarthy
  *
  *    Licensed under the Apache License, Version 2.0 (the "License");
  *    you may not use this file except in compliance with the License.
  *    You may obtain a copy of the License at
  *
  *        http://www.apache.org/licenses/LICENSE-2.0
  *
  *    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.
  */
package au.id.tmm.bfect

sealed trait ExitCase[+E, +A] {
  def as[A2](a2: A2): ExitCase[E, A2] = this match {
    case ExitCase.Succeeded(a)  => ExitCase.Succeeded(a2)
    case f @ ExitCase.Failed(_) => f
  }
}

object ExitCase {

  final case class Succeeded[A](a: A)             extends ExitCase[Nothing, A]
  final case class Failed[E](failure: Failure[E]) extends ExitCase[E, Nothing]

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy