Skip to content

Discuss possible PR for projection #9

@bbarker

Description

@bbarker

Now that I'm back to using Option I realized I needed another function, project. I also combined this with the recently added (in PR) getAll to get a convenience function, getSubset. It works well, but there are a few possible discussion points I can think of already:

  1. Is there a way to implement project without resorting to the FFI (the unexported utility function pickFn)? This is based almost exactly on pickFn from Record-Extra, but an undefined guard is needed here since Foreign.Object can have missing values, whereas a Record cannot. In any case I tried a few things to this end, namely using alter, but ran out of steam trying to massage the types. Denis Stoyanov had this note on Slack, which I'm not sure I follow exactly:

    I use it like newtype MyRecord (r :: # Type) = MyRecord (FO.Object (Exists Identity)) but just for example what is record will be

  2. I'm relying on Records.Extra just to get the Keys class and related functions, but we might want to reconsider this.
  3. Of course add docs when the dust settles.

Here is the branch and commit as of this posting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions