Skip to content

Instantly share code, notes, and snippets.

@dacr
Last active May 25, 2024 10:19
Show Gist options
  • Save dacr/b57b568c1c2f92eab0dd763952a87660 to your computer and use it in GitHub Desktop.
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
// 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