Getting Started
Dependency
Include Iron in your project using your preferred build tool.
SBT:
libraryDependencies += "io.github.iltotore" %% "iron" % "version"
Mill:
ivy"io.github.iltotore::iron:version"
Common imports
The following import is often used:
import io.github.iltotore.iron.*
This import contains bases to make Iron work including:
- Implicit conversion from raw type to its refined form (aka auto refinement)
- Utility methods
refine
,refineEither
andrefineOption
- Common constraints from package
io.github.iltotore.iron.constraint.any
Constraint imports
Standard constraints are split in different objects stored in the package io.github.iltotore.iron.constraint
.
For example, you can import standard number-related constraints using:
import io.github.iltotore.iron.constraint.numeric.*
When having multiple imports from Iron, this style is often preferred in Iron codebase or documentation:
import io.github.iltotore.iron.*
import io.github.iltotore.iron.constraint.all.*
Next steps
You can find the list of all standard constraints in the constraint package summary.
Now that you know how to import Iron in your project, you should check the references:
- Iron Type: the core data type of Iron.
- Constraint: to create your own constraints.
- Refinement Methods: to use constraints and refine values.
- New types: to encapsulate business refined types.
In this article