question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mirror.SumOf not being provided when 0 inhabitants

See original GitHub issue

Compiler version

3.0.0-RC1

Minimized code

import scala.deriving.*
sealed trait X
summon[Mirror.Of[X]]

Output

[error] 59 |  summon[Mirror.Of[X]]
[error]    |                      ^
[error]    |no implicit argument of type deriving.Mirror.Of[X] was found for parameter x of method summon in object Predef

Expectation

X is a sealed trait. I expect a Mirror.SumOf[X] { type MirroredElemTypes = EmptyTuple } to be provided.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:17 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
som-snyttcommented, May 11, 2022

An example would be, “Fool me once, shame on you. Fool me twice, shame on me.” There is no fool me zeroth. I guess we are always already fooled, which sounds about right to me.

1reaction
japgollycommented, May 10, 2022

Hello. As I understand it, which ever library you’re talking about currently doesn’t support sum types with no inhabitants (both because Scala 3 isn’t providing a mirror and because they’ve used reduce instead of foldLeft), so fixing up the Scala 3 side of the equation will result in it going from “not working” (via compilation error due to no implicit mirror) to “not working” (due to a crash). This doesn’t seem like a great reason to hold back the entire language. If it didn’t work before and wont work immediately after this change, we’re not breaking anything, we’re just discussing what the break looks like.

I really think we should add this to a minor release. That some library used reduce instead of foldLeft shouldn’t hold back Scala itself. Plus it would be trivial to fix such a library, no? 0 inhabitants isn’t some special case here, it’s just a natural part of the mathematics. Expecting at least one inhabitant is the artificial special case here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Divisibility of the sum of a number and its 'mirror'
No, I think you are misunderstanding the solution. The overbar notation in context seems to be this author's way of denoting a multidigit ......
Read more >
6A characterizing data Flashcards - Quizlet
Study with Quizlet and memorize flashcards containing terms like what is the mean, what is the median, what is the mode and more....
Read more >
Type Class Derivation Does Not Work With Contravariant Types
no implicit argument of type deriving.Mirror.Of[T] was found for parameter m of given instance derived in object Eq where: T is a type ......
Read more >
Standards and Guidelines for Statistical Surveys - SAMHSA
Standard 1.2: Agencies must develop a survey design, including defining the target population, designing the sampling plan, specifying the data collection ...
Read more >
Mean number of Decayed, Missing, and Filled Permanent ...
DMFT is the sum of the number of Decayed, Missing due to caries, and Filled ... 0: Sound - A crown/root is coded...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found