Conversation
Closes lspitzner#60
|
Why no Also, do we want strict |
treeowl
left a comment
There was a problem hiding this comment.
I don't know how many more functions to add. Do we want to do a whole Strict module like containers?
|
One option would be |
For adjusting the minimum, we can't do better than adjustMinWithKey' f = getSolo . adjustMinWithKey ((Solo $!) . f)Doing it "manually" with the constructors produces exactly the same Core, unfolding, inlining guidance, etc. So arguably we don't need |
I just realized I don't understand your last sentence. Implementing |
That might be a good idea, given the amount of strict functions. I agree that such a module should only export the strict functions. I'm also used to the strict version just having a
Yeah, we definitely shouldn't expect everyone to know that you can use
For those I'd say let the user force the elements. |
|
I'll ask around and see what people think. If we go with a separate module, strict insertion wouldn't be a big deal to include. Even strict extraction could make sense in that context—I wish minViewWithKey q >>= \((k, v :: Int), q') ->
Just (... [v + 1])will produce a thunk to calculate minViewWithKey' q = case minViewWithKey q of
r@(Just ((_, !_), _)) -> r
Nothing -> Nothingthis will not. minViewWithKey' q >>= \((k, v :: Int), q') ->
Just (... [v + 1]) |
|
I opened a discussion on Discourse: https://discourse.haskell.org/t/organization-of-strict-functions/6354. |
Closes #60