Last active
May 25, 2024 10:19
-
-
Save dacr/b57b568c1c2f92eab0dd763952a87660 to your computer and use it in GitHub Desktop.
iron refined type simplest usage example / published by https://github.com/dacr/code-examples-manager #355b00cf-7e9a-47ca-93c7-8c76a36d71cc/2326ca208b6b3df5ed8fe7273afa2bb42f0be08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// summary : iron refined type simplest usage example | |
// keywords : scala, iron, refined, @testable | |
// publish : gist | |
// authors : chimney | |
// license : Apache2 | |
// id : 355b00cf-7e9a-47ca-93c7-8c76a36d71cc | |
// created-on : 2024-02-16T08:42:10+01:00 | |
// managed-by : https://github.com/dacr/code-examples-manager | |
// run-with : scala-cli $file | |
//> using scala "3.4.2" | |
//> using dep "io.github.iltotore:iron:2.4.0" | |
import io.github.iltotore.iron.* | |
import io.github.iltotore.iron.constraint.numeric.* | |
def log(x: Double :| Positive): Double = Math.log(x) | |
//log(-1) // Not compiling ! :) | |
log(1d) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment