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" notifications@github.com 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.
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
#endifAnd similarly for UnitRTL.
|
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
Foldableinstance, then we can force it fromleft to right or from right to left.
Fixes #17