Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Setter): add: prepends setter #1058

Merged
merged 4 commits into from
Mar 7, 2024
Merged

feat(Setter): add: prepends setter #1058

merged 4 commits into from
Mar 7, 2024

Commits on Mar 1, 2024

  1. feat(Setter): add: prepends setter

    Add a setter that prepends the element, like `cons`.
    For balance, we also add a setter that also appends the element to the tail, like `snoc`.
    We often use this when adding elements to list structures and other order-conscious things.
    When we are doing natural language processing, for example, and we are adding processed data, it is more natural to add the resulting processed data to the head side if the original input source is closer to the head.
    Naturally we can also construct the processing by adding the tail if we think hard enough, but we don't want to work hard at that since we only need to prepare a function.
    The naming of the `<>:~` function was lost with `~<>`, but considering that the `~` symbol in the lenses setter operator is basically on the right, I used the `:` operator to indicate that it is closer to the `cons` of the list, rather than focusing on the contrast.
    ncaq committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    15f94a0 View commit details
    Browse the repository at this point in the history

Commits on Mar 6, 2024

  1. feat: add: <<>:~ and <<>:= operators

    Add "with result" variants.
    Code review reflected.
    ncaq committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    451ade5 View commit details
    Browse the repository at this point in the history
  2. refactor: move: Cons like operator from Setter to Cons

    What
    ===
    
    Move `(<|~)`, `(<|=)`, `(|>~)`, `(|>=)` from `Control.Lens.Setter` to `Control.Lens.Cons`.
    
    Why
    ===
    
    I try impl with result variants to `Control.Lens.Lens` like other.
    This requires the import of `Control.Lens.Cons` in `Control.Lens.Lens`.
    But it cause cycle import.
    So I decided to implement Cons-related operators with `Control.Lens.Cons`.
    ncaq committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    1c1295f View commit details
    Browse the repository at this point in the history
  3. feat: add: <<|~, <<|=, <|>~, <|>=

    Add Cons operators of "with result" variants.
    ncaq committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    71b25e9 View commit details
    Browse the repository at this point in the history