Skip to content
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

List fusion #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

List fusion #22

wants to merge 2 commits into from

Conversation

treeowl
Copy link
Contributor

@treeowl treeowl commented Jun 9, 2016

If the "general improvements" PR is merged, I'll rebase this.

* Remove unnecessary constraints from `Data.BitSet.Generic`.
* Use a more streamlined implementation of `foldl'` and `foldr'`
  when possible.
* Update Cabal file to indicate required extensions.
* Make the tests work again.
Make `fromList` fuse with `build` and `augment`, and make `toList` fuse
with `foldr`. Express the `toList/fromList` rule in terms of rewrite
helper targets; this has the pleasant side effect of letting it handle
things like `fromList $ toList xs ++ toList ys`.

Adjust arities of functions in `Data.BitSet.Word` to convince
most of the underlying functions to inline. I *think* this is
what we want.
@coveralls
Copy link

Coverage Status

Coverage increased (+3.8%) to 87.931% when pulling 231962e on treeowl:list-fusion into bf70326 on lambda-llama:master.

@@ -124,7 +124,7 @@ insert = GS.insert

-- | /O(1)/. Delete an item from the bit set.
delete :: Enum a => a -> BitSet a -> BitSet a
delete = GS.delete
delete x xs = GS.delete x xs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, could you explain why the arguments are necessary here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look at the generated core with -O2. All will be fine if WS.delete is fully
applied and inlines, but if it's partially applied and passed to a
higher-order function that doesn't inline, the Bits dictionary may be
passed at runtime (I believe). The extra parameters there are to fully
apply GS.delete in WS.delete, so GHC will inline it when compiling
WS.delete.
On Jun 15, 2016 2:45 PM, "Sergei Lebedev" [email protected] wrote:

In src/Data/BitSet/Word.hs
#22 (comment):

@@ -124,7 +124,7 @@ insert = GS.insert

-- | /O(1)/. Delete an item from the bit set.
delete :: Enum a => a -> BitSet a -> BitSet a
-delete = GS.delete
+delete x xs = GS.delete x xs

Hmm, could you explain why the arguments are necessary here?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/lambda-llama/bitset/pull/22/files/231962e0e6a63fe63e1952826f97ca529f20a4e5#r67221750,
or mute the thread
https://github.com/notifications/unsubscribe/ABzi_QRX_uV6tfFowIlj45kg27ygZu9Cks5qMEg4gaJpZM4IyfKO
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants