Coder Social home page Coder Social logo

frames-map-reduce's People

Contributors

adamconnersax avatar o1lo01ol1o avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

frames-map-reduce's Issues

Rec (Maybe :. EltField) rs?

I took an exploratory stab at trying to make some of the combinators in this library polymorphic in the interpretation functor and quickly ran up against the limits of its design. I imagine it's not straightforward (having run into similar difficulties myself) to to express folds over records where data may be missing.

Have you given such an implementation any thought?

The expected functionality, I think, would be something like:

  • in the case of a key a, use the composite Maybe a for grouping.
  • in the case of data as, if there's Nothing, then there's no step, otherwise take the data and step.

The two sources of difficulty in my mind are constraining the payload through the composed functors and, at the same time, running the fold on the undistributed version of the data.

(Separately, it'd also be nice to be able to support ARecs as well.)

Generalizing over record type and interpretation functor

cc: @o1lo01ol1o
I finished rounding out the Maybe stuff you did in #2. It's in the latest commit on master. I did the minimum required to restore all the functions that were already there in the non-Maybe version. I added

rgetMaybeField
  :: forall t rs
   . (V.KnownField t, F.ElemOf rs t, V.FieldType (V.Fst t) rs ~ V.Snd t)
  => F.Rec (Maybe :. ElField) rs
  -> Maybe (V.Snd t)
rgetMaybeField = fmap V.getField . V.getCompose . V.rgetf (V.Label @(V.Fst t))

and

-- | Control.Foldl helper for filtering Nothings
maybeFold :: FL.Fold a b -> FL.Fold (Maybe a) b
maybeFold (FL.Fold step begin done) = FL.Fold step' begin done
  where step' x ma = maybe x (step x) ma

to help and to point the way to generalization.

and made your foldAllConstrained into maybeFoldAllConstrained so that I could re-use foldAllConstrained for the case when the input fold is Fold a a which is then generalized to Fold (Maybe a) (Maybe a) via fmap Just . maybeFold

If you have a chance to take a look, that would be great.
Now I'm going to make a branch to try and generalize it all, including the record-type. If that works, I'll try to re-express these as monomorphizations (is that a word??) of the general thing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.