RefinedTypeOpsImpl

io.github.iltotore.iron.RefinedTypeOpsImpl
trait RefinedTypeOpsImpl[A, C, T]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Concrete methods

inline def apply(value: IronType[A, C]): T

Implicitly refine at compile-time the given value.

Implicitly refine at compile-time the given value.

Attributes

A

the refined type.

C

the constraint applied to the type.

constraint

the implementation of C to check.

value

the value to refine.

Returns:

the given value typed as IronType

Note:

This method ensures that the value satisfies the constraint. If it doesn't or isn't evaluable at compile-time, the compilation is aborted.

inline def applyUnsafe(value: A)(using Constraint[A, C]): T

Refine the given value at runtime.

Refine the given value at runtime.

Attributes

constraint

the constraint to test with the value to refine.

Returns:

this value as T.

Throws:
an

IllegalArgumentException if the constraint is not satisfied.

See also:

fromIronType, either, option.

inline def assume(value: A): T

Refine the given value at runtime, assuming the constraint holds.

Refine the given value at runtime, assuming the constraint holds.

Attributes

Returns:

a constrained value, without performing constraint checks.

See also:
inline def either(value: A)(using constraint: Constraint[A, C]): Either[String, T]

Refine the given value at runtime, resulting in an Either.

Refine the given value at runtime, resulting in an Either.

Attributes

constraint

the constraint to test with the value to refine.

Returns:

a Right containing this value as T or a Left containing the constraint message.

See also:

fromIronType, option, applyUnsafe.

inline def option(value: A)(using constraint: Constraint[A, C]): Option[T]

Refine the given value at runtime, resulting in an Option.

Refine the given value at runtime, resulting in an Option.

Attributes

constraint

the constraint to test with the value to refine.

Returns:

an Option containing this value as T or None.

See also:

fromIronType, either, applyUnsafe.

Givens

Givens

inline given given_Mirror_T: given_Mirror_T

Extensions

Extensions

extension (wrapper: T)
inline def value: IronType[A, C]