You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've found myself writing both bitToBool . reduceOr and And . reduceAnd a lot, so I realized what I probably want is a combination of the two:
reduceAll :: (BitPack a) => a -> All
reduceAll = All . bitToBool . reduceAnd
reduceAny :: (BitPack a) => a -> Any
reduceAny = Any . bitToBool . reduceOr
This works even better if Any and All itself have BitPack instances, since then this can be used at different layers of structures.
So what do we think about adding these (and also the deriving via Bool instance BitPack All; deriving via Bool instance BitPack Any instances) to clash-prelude?
The text was updated successfully, but these errors were encountered:
I'm fine with the semantics, but not yet convinced with the syntax. The other reduceXYZ functions spell out the operators they reduce with, these new function spell out what they reduce to. I wonder if we can can think of something better than reduceToAny and reduceToAll...
I've found myself writing both
bitToBool . reduceOr
andAnd . reduceAnd
a lot, so I realized what I probably want is a combination of the two:This works even better if
Any
andAll
itself haveBitPack
instances, since then this can be used at different layers of structures.So what do we think about adding these (and also the
deriving via Bool instance BitPack All; deriving via Bool instance BitPack Any
instances) toclash-prelude
?The text was updated successfully, but these errors were encountered: