-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
keys
and kind erasure
#105
Comments
Could you elaborate why that is a problem? |
Suppose I wanted to do some check on every key in the map, e.g. I was writing
This is invalid because |
Yes, I see. So you’d like data TypeRepOfKind k where
TypeRepOfKind :: forall k (a :: k). !(TypeRep a) -> TypeRepOfKind k And its type would be: keys :: TypeRepMap (f :: k -> Type) -> [TypeRepOfKind k] Is that right? |
This solves the problem yes. However I'm not super sure if that's the best solution (I don't have a different one in mind). The problem is that |
I suppose we could let the user define their own wrapper. Something like this: keysWith :: forall k r. (forall (a :: k). TypeRep a -> r) -> TypeRepMap (f :: k -> Type) -> [r] Then the existing keys = keysWith SomeTypeRep And you could define your own for the use case you have: keysWithKind = keysWith TypeRepOfKind |
If you're going to do this, I'd also appreciate a |
Would you be interested in writing a patch for this? |
Consider the type of
keys
:this looks fine until you consider the kinds:
the value of
k
is erased! We can try to get it back by patching onSomeTypeRep
and gettingrep :: TypeRep (a' :: k')
andtypeRepKind rep:: TypeRep k'
, then we could try totestEquality
, but that requires an extra Typeable constraint on the k, which isn't actually anywhere to be found if say the map is empty.The text was updated successfully, but these errors were encountered: