Closed LightAndLight closed 5 years ago
It seems you swapped HasType Int s
in the signature of theInt
. And that would indeed be equivalent to HasTypeConstraints s Int
. That said it might be worth adding a comment to HasType
because these parameters are easy to mix up.
Thanks, I've fixed it to be consistent with what's already in the library.
I meant that now theInt
typechecks, which removes the motivation for HasTypeConstraints
.
How confusing- the initial example does in fact compile. I'll revisit this tomorrow and see what I'm missing. I definitely encountered a problem in this area.
I'm busy with other things so I'm going to close this. If I come across the issue again I'll re-open.
There are some programs that I can't give a type signature, because the constraints I need to add to the signature are not exported by
generic-lens
. For example, withData.Generics.Product.Typed
:I can't finish this definition, because I can't reference
ErrorUnlessOne
andHasTotalTypePSym
.I think that just exporting these names would be unwieldy, so we could define a constraint synonym for them:
Then
HasTypeConstraints
can be exported along withHasType
.Now my definition becomes:
Which should now compile.
What do you think? A similar approach would follow for all the classes. I'm happy to do the work if you think this is useful.