Gabriella439 / foldl

Composable, streaming, and efficient left folds
BSD 3-Clause "New" or "Revised" License
159 stars 51 forks source link

Fold looks a Profunctor #36

Closed srijs closed 9 years ago

srijs commented 9 years ago

Fold looks like a profunctor:

instance Profunctor Fold where
    lmap = premap
    rmap = fmap

Is there interest in declaring it as such?

Gabriella439 commented 9 years ago

My original policy used to be to wait until profunctors was in the Haskell Platform, but now that the Haskell Platform is being deemphasized I'm okay with taking on the profunctors dependency. Could you submit a pull request to add this?

michaelt commented 9 years ago

profunctor will add these dependencies

nats
stm
StateVar
tagged
hashable
transformers-compat
distributive
unordered-containers
semigroups
void
contravariant
comonad

Which suggests that a number of other instances should be written. Several are defined for the 'pure' Fold type https://github.com/ekmett/folds/blob/master/src/Data/Fold/L'.hs

Gabriella439 commented 9 years ago

My policy is to add instances on a "need-to-have" basis to avoid diluting the instance list with type classes that would distract from the important ones (i.e. Applicative).