We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
hoistWithKey :: (forall x. Typeable x => f x -> g x) -> TypeRepMap f -> TypeRepMap g
Adding this function will require adding another vector that will store TypeReps:
TypeRep
data TypeRepMap (f :: k -> Type) = TypeRepMap { fingerprintAs :: {-# UNPACK #-} !(PrimArray Word64) -- ^ first components of key fingerprints , fingerprintBs :: {-# UNPACK #-} !(PrimArray Word64) -- ^ second components of key fingerprints , anys :: {-# UNPACK #-} !(Array Any) -- ^ values stored in the map , keys :: {-# UNPACK #-} !(Array Any) -- ^ typerep keys }
In hoistWithKey we can access a corresponding element in keys, cast it to TypeRep a and then apply https://hackage.haskell.org/package/base-4.11.1.0/docs/Type-Reflection.html#v:withTypeable to get the Typeable instance.
hoistWithKey
keys
TypeRep a
Typeable
I'm hoping it won't affect the performance of lookups: the cachedBinarySearch function will stay unchanged.
cachedBinarySearch
Implementation plan:
withTypeable
The text was updated successfully, but these errors were encountered:
Having this function will also make it possible to write a useful map for TMap:
map
TMap
map :: (forall a. Typeable a => a -> a) -> TMap -> TMap
which is an instantiation of hoistWithKey to Identity
Identity
Sorry, something went wrong.
[#39] Add hoistWithKey and map for TMap
92bf2e5
[#39] Add hoistWithKey and map for TMap (#45)
0abe416
* [#39] Add hoistWithKey and map for TMap * Use coerce instead of fmap
vrom911
No branches or pull requests
Adding this function will require adding another vector that will store
TypeRep
s:In
hoistWithKey
we can access a corresponding element inkeys
, cast it toTypeRep a
and then apply https://hackage.haskell.org/package/base-4.11.1.0/docs/Type-Reflection.html#v:withTypeable to get theTypeable
instance.I'm hoping it won't affect the performance of lookups: the
cachedBinarySearch
function will stay unchanged.Implementation plan:
keys
field, check that the benchmarks show no changehoistWithKey
. it should be probably available only on 8.2+ because it relies on the newTypeRep
forwithTypeable
The text was updated successfully, but these errors were encountered: