effekt-lang / effekt-lang/effekt
Type annotations for patterns
- Dominant language
- Scala
- Stars
- 469
- Forks
- 41
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 23
Description
Currently, we can't write the `: Int` part of
```scala
expr match {
case Cons(x: Int, _) => x // doesn't parse, "Expected ) but got :"
...
}
```
similarly, we can't use it in `if (expr is Some(x: String))` and `val Some(b: Bool) = expr`.
This is especially annoying for tuple parameters
```scala
// argument list works
def f { g: (Int, String) => Unit }: Unit = g(0, "")
f { (x: Int, y) => () } // works (and reports an error if the annotation is wrong)
// tuple does not
def f { g: ((Int, String)) => Unit }: Unit = g((0, ""))
f { case (x: Int, y) => () } // doesn't parse, "Expected ) but got :"
```
However, I do **not** want to use it for runtime matching like in Scala:
```scala
// not this, please
expr match {
case n: Int => ...
case s: String => ...
case _ => panic("ohno")
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.