-
Notifications
You must be signed in to change notification settings - Fork 60
Traverse better #88
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
Traverse better #88
Conversation
|
Do we still support pre-7.2 GHC, or can I kill that CPP? |
|
We don’t support pre 7.2, and in fact I think because 7.2 was just a tech
preview release we may only currently support 7.4 onwards ? I could be
wrong though
…On Sun, Mar 18, 2018 at 2:44 AM David Feuer ***@***.***> wrote:
Do we still support pre-7.2 GHC, or can I kill that CPP?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#88 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAAQwtOhQAdyjMo0f42qMhGym4TiqKtDks5tfgJUgaJpZM4SvFst>
.
|
|
Yep, we only support GHC 7.4 and later (see #83 (comment)), so go ahead and kill that CPP. |
e006ec4 to
6f3d4ab
Compare
|
I amended the commit to avoid adding 7.2-related CPP, and added a commit to remove the rest of said CPP from |
6f3d4ab to
41c543a
Compare
|
Hrm..... Turned out what I was doing to turn the |
|
Actually, I think I see how to fix that. It's a bit ugly, and only available for recent GHC, but I think I'll do it anyway. One more fix incoming... |
|
(Ugly as in ugly source code. It's actually cleaner in a sense. |
|
Oh, actually, I can make it work for older versions too, with a perfectly safe |
|
Eh, I changed my mind. Source code gets too messy, and the benefits seem too limited. I think this is ready to merge as is. |
b6157c7 to
6e92476
Compare
Instead of traversing a list and then converting to an array, be more direct. GHC seems to be able to optimize this better, at least in common cases. Addresses haskell#85.
* Add `unsafeTraverseArray` and `unsafeTraverseSmallArray` functions. * Add rewrite rules to use them for traversals in `ST s` and `IO`. * Add rewrite rules for traversing in `Identity`.
6e92476 to
90e2e59
Compare
RyanGlScott
left a comment
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 looks entirely plausible to me. Like foldl, it might be nice to write some QuickCheck tests for this, but I'd be fine if you want to merge this now.
Instead of traversing a list and then converting to an array,
be more direct. GHC seems to be able to optimize this better,
at least in common cases.
Add functions for traversing arrays in "affine" primitive monads: monad transformer stacks built from
StateT,ReaderT,WriterT,RWST,ExceptT,Stream (Of a), etc., but not, for example,ListT(done right or otherwise) orLogicT.Fixes #85.