fthomas / fthomas/refined

RFE: A version of Inference[P, C] that fails for implicit chaining

Open
#755 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Scala
Stars
1.7k
Forks
152
Avg merge
1h 20m
Merged PRs (30d)
6

Description

I could use a version of `Inference` that always fails to manifest. For example, the following inference "fails" but it doesn't fail to manifest, it just has a `false` value:
```scala
scala> implicitly[Inference[Greater[-1], Greater[0]]]
res7: eu.timepit.refined.api.Inference[eu.timepit.refined.numeric.Greater[-1],eu.timepit.refined.numeric.Greater[0]] = Inference(false,greaterInference(-1, 0))
```
This works for the casting in `InferMacro` and `autoInfer` but it's limited in how it can be used in chained implicits.

I could use an alternative that will fail like so:
```scala
scala> implicitly[ChainableInference[Greater[-1], Greater[0]]]
error: could not find implicit value ...
```
Given the current design, I think that another similar macro which returns a chainable inference type but only if `inference.notValid` is false, instead of just doing an implicit value conversion.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.