io.github.iltotore.iron
Members list
Type members
Classlikes
A typeclass representing the implementation of a constraint of a certain type of value.
A typeclass representing the implementation of a constraint of a certain type of value.
Type parameters
- A
-
the type of the value to test.
- C
-
the constraint associated with this implementation.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
Show all
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Constraint.type
An algebraic implication between two constraints (e.g transitivity for constraint.numeric.Greater).
An algebraic implication between two constraints (e.g transitivity for constraint.numeric.Greater).
Type parameters
- C1
-
the assumed constraint.
- C2
-
the constraint implied by
C1.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Implication.type
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
IronType.type
A typeclass providing a map method. Mainly used to abstract over Cats and ZIO Prelude.
A typeclass providing a map method. Mainly used to abstract over Cats and ZIO Prelude.
Type parameters
- F
-
the wrapper type
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
RefinedType.type
A RuntimeConstraint is similar to a Constraint with the difference that it can be used in non-inlined methods.
A RuntimeConstraint is similar to a Constraint with the difference that it can be used in non-inlined methods.
This allows refinement of values in polymorphic methods / givens without the use of inline. e.g., the code below would fail to compile if Constraint was used instead.
def foo[A, C](value: A)(using c: RuntimeConstraint[A, C]): Either[String, A :| C] =
if c.test(value) then Right(value.assume[C]) else Left(c.message)
In cases that one does not exist in scope, one will be automatically derived from a Constraint.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
RuntimeConstraint.type
Methods and types to ease compile-time operations.
Methods and types to ease compile-time operations.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
compileTime.type
Types
Alias for Implication. Similar to the mathematical implication symbol, often represented by an arrow.
Alias for Implication. Similar to the mathematical implication symbol, often represented by an arrow.
Attributes
An Iron type (refined).
An Iron type (refined).
Type parameters
- A
-
the underlying type.
- C
-
the predicate/constraint guarding this type.
Attributes
Extensions
Extensions
Refine the given value, assuming the constraint holds.
Refine the given value, assuming the constraint holds.
Attributes
- Returns
-
a constrained value, without performing constraint checks.
- See also
-
assumeAll, autoRefine, refineUnsafe.
Refine the given value at runtime, resulting in an Either.
Refine the given value at runtime, resulting in an Either.
Value parameters
- constraint
-
the constraint to test with the value to refine.
Attributes
- Returns
-
a Right containing this value as IronType or a Left containing the constraint message.
- See also
-
autoRefine, refineUnsafe, refineOption.
Refine the given value at runtime, resulting in an Option.
Refine the given value at runtime, resulting in an Option.
Value parameters
- constraint
-
the constraint to test with the value to refine.
Attributes
- Returns
-
an Option containing this value as IronType or None.
- See also
-
autoRefine, refineUnsafe, refineEither.
Refine the given value again, assuming the constraint holds.
Refine the given value again, assuming the constraint holds.
Attributes
- Returns
-
a constrained value, without performing constraint checks.
- See also
-
assume, assumeAllFurther.
Refine the given value again at runtime, resulting in an Either.
Refine the given value again at runtime, resulting in an Either.
Value parameters
- constraint
-
the new constraint to test.
Attributes
- Returns
-
a Right containing this value refined with
C1 & C2or a Left containing the constraint message. - See also
Refine the given value again at runtime, resulting in an Option.
Refine the given value again at runtime, resulting in an Option.
Value parameters
- constraint
-
the new constraint to test.
Attributes
- Returns
-
a Option containing this value refined with
C1 & C2or None. - See also
Refine the contained value(s), assuming the constraint holds.
Refine the contained value(s), assuming the constraint holds.
Attributes
- Returns
-
constrained values, without performing constraint checks.
- See also
-
assume, autoRefine, refineUnsafe.
Refine the given value(s) at runtime, resulting in an Either.
Refine the given value(s) at runtime, resulting in an Either.
Value parameters
- constraint
-
the constraint to test with the value to refine.
Attributes
- Returns
-
a Right containing the given values as IronType or a Left containing the constraint message.
- See also
Refine the given value(s) at runtime, resulting in an Option.
Refine the given value(s) at runtime, resulting in an Option.
Value parameters
- constraint
-
the constraint to test with the value to refine.
Attributes
- Returns
-
a Some containing the given values as IronType or None.
- See also
Refine the given value(s) again, assuming the constraint holds.
Refine the given value(s) again, assuming the constraint holds.
Attributes
- Returns
-
the constrained values, without performing constraint checks.
- See also
-
assume, assumeFurther.
Refine the given value(s) again at runtime, resulting in an Either.
Refine the given value(s) again at runtime, resulting in an Either.
Value parameters
- constraint
-
the new constraint to test.
Attributes
- Returns
-
a Right containing the given values refined with
C1 & C2or a Left containing the constraint message. - See also
Refine the given value(s) again at runtime, resulting in an Option.
Refine the given value(s) again at runtime, resulting in an Option.
Value parameters
- constraint
-
the new constraint to test.
Attributes
- Returns
-
a Option containing the given values refined with
C1 & C2or None. - See also
Refine the given value(s) again at runtime.
Refine the given value(s) again at runtime.
Value parameters
- constraint
-
the new constraint to test.
Attributes
- Returns
-
the given values refined with
C1 & C2. - Throws
-
IllegalArgumentException
if the constraint is not satisfied.
- See also
-
refineUnsafe, refineFurtherUnsafe.
Implicits
Implicits
Implicitly cast a constrained value to another if verified.
Implicitly cast a constrained value to another if verified.
Type parameters
- A
-
the refined type.
- C1
-
the original constraint.
- C2
-
the target constraint.
Value parameters
- `C1
-
==> C2
the evidence that the original constraintC1impliesC2`. - value
-
the refined to value to cast.
Attributes
- Returns
-
the given value constrained by
C2.
Implicitly cast an iterable constrained by ForAll[C1] into an iterable of elements constrained by C2 if C1 implies C2.
Implicitly cast an iterable constrained by ForAll[C1] into an iterable of elements constrained by C2 if C1 implies C2.
Type parameters
- A
-
the refined type.
- C1
-
the original constraint.
- C2
-
the target constraint.
- I
-
the iterable type.
Value parameters
- `C1
-
==> C2
the evidence thatC1impliesC2`. - iterable
-
the iterable to factorize.
Attributes
- Returns
-
the given value as instance of
I[A :| C2]. - See also
Implicitly cast an iterable of elements constrained by C1 into an iterable constrained by ForAll[C2] if C1 implies C2.
Implicitly cast an iterable of elements constrained by C1 into an iterable constrained by ForAll[C2] if C1 implies C2.
Type parameters
- A
-
the refined type.
- C1
-
the original constraint.
- C2
-
the target constraint.
- I
-
the iterable type.
Value parameters
- `C1
-
==> C2
the evidence thatC1impliesC2`. - iterable
-
the iterable to factorize.
Attributes
- Returns
-
the given value as instance of
I[A] :| ForAll[C2]. - See also
Implicitly refine at compile-time the given value.
Implicitly refine at compile-time the given value.
Type parameters
- A
-
the refined type.
- C
-
the constraint applied to the type.
Value parameters
- constraint
-
the implementation of
Cto check. - value
-
the value to refine.
Attributes
- 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.