Auto Tupling when partial function is expected
See original GitHub issueThis currently compiles:
class Test {
def foo(f: PartialFunction[(Int, Int), Int]) = ???
foo((a, b) => 1)
}
I don’t think we should apply auto-tupling in this case though.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Using Tuples in map, flatmap,... partial functions - Stack Overflow
For an apply, you get "auto-tupling": ... But you don't get auto-untupling. ... First, the type syntax of parameter function for the map...
Read more >SIP: Auto-tupling of n-ary functions. · Issue #897 · lampepfl/dotty
Auto -tupling composes with eta-expansion. That is an n-ary function generated by eta-expansion can in turn be adapted to the expected type ...
Read more >Let's drop auto-tupling - Language Design - Scala Contributors
It seems to be that most people who have given some thought about this issue are coming down to drop this feature, instead...
Read more >Tupling Calculation Eliminates Multiple Data ... - CiteSeerX
Abstract. Tupling is a well-known transformation tactic to obtain new e cient recursive functions by grouping some recursive func- tions into a tuple....
Read more >Tupling calculation eliminates multiple ... - ACM Digital Library
Tupling is a well-known transformation tactic to obtain new efficient recursive functions by grouping some recursive func- tions into a tuple.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I personally think this behavior is intuitive. A total function is a partial function that happens to cover all inputs. I wish
Function
was a subtype ofPartialFunction
instead of the other way around, it’s one of the biggest warts in the standard library in my opinion.I am not sure anymore what the right way is. Anyway, I don’t think we should act on this until we have sorted out PartialFunctions. And once we did that, the answer to the question of auto-tupling or not is probably “whatever fits best”.