Skip to content

Instantly share code, notes, and snippets.

@dacr
Created April 20, 2024 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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/2624a86d0a0a459ba76dffd2b3366d1944df9d64
// 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.3.1"
//> 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