LiftToResult

org.llm4s.util.LiftToResult
See theLiftToResult companion trait
object LiftToResult

Attributes

Companion
trait
Source
LiftToResult.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Types

Type alias for Either[Throwable, *], provided so that LiftToResult can be instantiated for this 1-parameter shape without requiring kind-projector.

Type alias for Either[Throwable, *], provided so that LiftToResult can be instantiated for this 1-parameter shape without requiring kind-projector.

Attributes

Source
LiftToResult.scala

Value members

Concrete methods

Creates a LiftToResult instance for scala.Option: Some(a) lifts to Right(a); None lifts to Left(onNone).

Creates a LiftToResult instance for scala.Option: Some(a) lifts to Right(a); None lifts to Left(onNone).

There is no implicit instance for Option because there is no canonical error for the empty case — callers must supply the error explicitly.

Value parameters

onNone

the error returned when the option is empty

Attributes

Source
LiftToResult.scala

Implicits

Implicits

Lifts Either[Throwable, A] into Result[A] by converting any Left throwable into an org.llm4s.error.LLMError using org.llm4s.error.ThrowableOps.RichThrowable#toLLMError with the org.llm4s.core.safety.DefaultErrorMapper.

Lifts Either[Throwable, A] into Result[A] by converting any Left throwable into an org.llm4s.error.LLMError using org.llm4s.error.ThrowableOps.RichThrowable#toLLMError with the org.llm4s.core.safety.DefaultErrorMapper.

This instance is useful when integrating with Java or Try-based code that surfaces failures as Throwable rather than a typed error.

Attributes

Source
LiftToResult.scala
implicit val idInstance: LiftToResult[Id]

cats.Id always succeeds — wraps the value in Right.

cats.Id always succeeds — wraps the value in Right.

Attributes

Source
LiftToResult.scala
implicit val tryInstance: LiftToResult[Try]

Lifts scala.util.Try[A] into Result[A]: Success(a) becomes Right(a); Failure(t) converts the throwable to an org.llm4s.error.LLMError using org.llm4s.error.ThrowableOps.RichThrowable#toLLMError with the org.llm4s.core.safety.DefaultErrorMapper.

Lifts scala.util.Try[A] into Result[A]: Success(a) becomes Right(a); Failure(t) converts the throwable to an org.llm4s.error.LLMError using org.llm4s.error.ThrowableOps.RichThrowable#toLLMError with the org.llm4s.core.safety.DefaultErrorMapper.

Attributes

Source
LiftToResult.scala