-
Notifications
You must be signed in to change notification settings - Fork 29
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
Add rnfFoldableLTR and rnfFoldableRTL #18
Conversation
If a type has a `Foldable` instance, then we can force it from left to right or from right to left. Fixes haskell#17
For context: Haskell libraries mailing list discussion: https://mail.haskell.org/pipermail/libraries/2016-July/027164.html |
This should carry a huge warning that it is normally not a sensible definition for |
It has such a warning, specifically mentioning On Jul 27, 2016 5:03 PM, "Reid Barton" [email protected] wrote:
|
Oh, so it does. There is such a lot of noise in the diff that I missed it. |
|
||
instance Monoid UnitLTR where | ||
mempty = UnitLTR () | ||
UnitLTR () `mappend` y = y |
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.
To avoid invoking the wrath of -Wnoncanonical-monoid-instances
in later GHCs, it'd be prudent to define mappend
like this:
instance Monoid UnitLTR where
mempty = UnitLTR ()
#if MIN_VERSION_base(4,9,0)
mappend = (<>)
#else
UnitLTR () `mappend` y = y
#endif
And similarly for UnitRTL
.
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.
Sure.
This seems useful, can this be worked in to the modern deepseq? |
Perhaps I’m overlooking something obvious : but can’t we tease out
assoxiativity of a structure from its foldmap?
…On Fri, May 3, 2019 at 6:56 PM chessai ***@***.***> wrote:
This seems useful, can this be worked in to the modern deepseq?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#18 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAABBQXQJ6QXWWMAR4BP2TDPTS7JJANCNFSM4CJYQ6WQ>
.
|
Are we worried at all about the loss of |
|
If a type has a
Foldable
instance, then we can force it fromleft to right or from right to left.
Fixes #17