-
Notifications
You must be signed in to change notification settings - Fork 485
Keep track of currency/token lengths in builtin Value #7349
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
Conversation
|
. fromInteger | ||
. uncurry (*) | ||
. (toInteger . Value.totalSize &&& toInteger . (+1) . Value.maxKeyLength) | ||
. unValueTotalSize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: at this point I'd just use a where
or a let
.
-- | Like `pack` but does not normalize. | ||
pack' :: NestedMap -> Value | ||
pack' (normalize -> v) = Value v sizes size | ||
pack' (normalize -> v) = Value v sizes lens size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment says it doesn't normalize, but it does normalize.
( IntMap.alter (maybe (Just 1) (Just . (+ 1))) (Map.size inner) ss | ||
, IntMap.unionWith | ||
(+) | ||
(IntMap.alter (maybe (Just 1) (Just . (+ 1))) (B.length currency) ls) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This IntMap.alter <...>
pattern occurs a lot, give it a general name like incOne
or whatever (and use that instead of incLen
)?
The memory usage of Values are updated to include a factor of max key length in the Value.