Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow both raw and refined types in RefinedTypeOps#apply #261

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

Iltotore
Copy link
Owner

RefinedTypeOps#apply now accepts A with a given Constraint[A, C] instance. Since most of the Constraint instances are non-orphan (aka defined inside the companion object of C or A or Constraint), they do not need to be imported.

package types

import io.github.iltotore.iron.*
import io.github.iltotore.iron.constraint.numeric.Positive

opaque type Temperature = Double :| Positive
object Temperature extends RefinedTypeOps[Double, Positive, Temperature]
//No `io.github.iltotore.iron...` import needed
import types.Temperature

object Main:

  @main
  def testMain =
    println(Temperature(100))

To be completely blackbox (excluding RefinedTypeOps.Mirror), Scala needs to support inline trait/constructor parameters.

@Iltotore Iltotore merged commit 8850124 into main Aug 29, 2024
2 checks passed
@Iltotore Iltotore deleted the feat/refinedtypeops-blackbox branch August 29, 2024 12:06
@Iltotore Iltotore linked an issue Aug 29, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make RefinedTypeOps blackbox
1 participant