Skip to content

Commit

Permalink
add constraint opaques types
Browse files Browse the repository at this point in the history
  • Loading branch information
vbergeron-ledger committed Nov 28, 2023
1 parent 4437f93 commit cc49627
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions slides.md
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,27 @@ Functional

No implementation leak

```scala
opaque type Positive <: Int = Int :| Greater[0]

object Positive extends RefinedTypeOps[Int, Greater[0], Positive]
```

## Constrained Opaque Types

Constraint factorization

```scala
private type SatsConstraint =
GreaterEqual[0] & LessEqual[100000000 * 21000000]

opaque type Sats <: Long = Long :| SatsConstraint

object Sats extends RefinedTypeOps[Long, SatsConstraint, Sats]
```

## Before / After

# Iron ![](images/scalalove-logo.svg){.logo} Ecosystem

## Refinement outputs
Expand Down

0 comments on commit cc49627

Please sign in to comment.