fthomas / fthomas/refined

Use value-level terminology on type-level

Open
#219 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 think it would be great if we could use the same language at the type-level like at the value level. At least as close as possible. E.g.

Instead of
```
val x: Int Refined Greater[W.`5`.T]
```

```
val x: Int > W.`5`.T
```

This is syntactically possible, see e.g. https://github.com/cvogt/scala-extensions/blob/master/src/test/scala/constraint/boolean.scala

The question is what the best implementation for this would be in refined. I think concerns would be performance and impact on type error messages.

**Alternative 1**
```
type >[L,R] = L Refined Greater[R]
```
Does this impact error messages, do they dealias?

**Alternative 2**
Making `Refined` non-final and probably co-variant and
```
class >[L,R](val get: L) extends Refined[L,Greater[R]](get)
```
Does this prevent value classes?

**Alternative 3**
Not having a Refined super type, but individual types for each constraint.
```
class >[L,R](val get: L) extends AnyVal
```
Does this make things harder anywhere?

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.