deepseq icon indicating copy to clipboard operation
deepseq copied to clipboard

Add rnfFoldableLTR and rnfFoldableRTL

Open treeowl opened this issue 8 years ago • 7 comments

If a type has a Foldable instance, then we can force it from left to right or from right to left.

Fixes #17

treeowl avatar Jul 17 '16 01:07 treeowl

For context: Haskell libraries mailing list discussion: https://mail.haskell.org/pipermail/libraries/2016-July/027164.html

RyanGlScott avatar Jul 17 '16 14:07 RyanGlScott

This should carry a huge warning that it is normally not a sensible definition for Foldable instances where f a contains fields of types other than a, such as a pair.

rwbarton avatar Jul 27 '16 21:07 rwbarton

It has such a warning, specifically mentioning Either a and (,) a. Is the warning insufficient?

On Jul 27, 2016 5:03 PM, "Reid Barton" [email protected] wrote:

This should carry a huge warning that it is normally not a sensible definition for Foldable instances where f a contains fields of types other than a, such as a pair.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/haskell/deepseq/pull/18#issuecomment-235720235, or mute the thread https://github.com/notifications/unsubscribe-auth/ABzi_djQZ4CsXZJuz8q7fJP_0C8XJgpyks5qZ8esgaJpZM4JOIet .

treeowl avatar Jul 27 '16 21:07 treeowl

Oh, so it does. There is such a lot of noise in the diff that I missed it.

rwbarton avatar Jul 27 '16 21:07 rwbarton

This seems useful, can this be worked in to the modern deepseq?

chessai avatar May 03 '19 22:05 chessai

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 [email protected] 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 https://github.com/haskell/deepseq/pull/18#issuecomment-489264650, or mute the thread https://github.com/notifications/unsubscribe-auth/AAABBQXQJ6QXWWMAR4BP2TDPTS7JJANCNFSM4CJYQ6WQ .

cartazio avatar May 04 '19 23:05 cartazio

Are we worried at all about the loss of Safe?

chessai avatar Dec 29 '19 20:12 chessai

foldMap can be more efficient than either foldl or foldr, so Unit was added by #106 (same as UnitLTR).

mixphix avatar Aug 25 '24 12:08 mixphix