Skip to content

Rewrite with lenses? #1015

Description

@snarfed

Granary does what's affectionately known as "shotgun parsing." Its translation logic is consistently mixed with .get()s, conditionals, and similar handling for fields that can be optional, have multiple types, etc.

Lenses are one alternative. They separate normalization from translation so that translation can assume a static schema with many more guarantees and invariants.

In an alternate world, granary could be a lens engine and a set of lens transformations between formats. It'd probably be best to do it as a full rewrite, or even a separate project altogether. Worth a try sometime!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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