Skip to content

Potentially move to another module #12

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

Open
ethul opened this issue Sep 6, 2017 · 0 comments
Open

Potentially move to another module #12

ethul opened this issue Sep 6, 2017 · 0 comments

Comments

@ethul
Copy link
Owner

ethul commented Sep 6, 2017

reducerOptic :: forall state state' action action'. Lens' state state' -> Prism' action action' -> Reducer' action' state' -> Reducer' action state
reducerOptic lens prism k =
  wrap $ \action state ->
    let
      state' :: state'
      state' = view lens state

      action' :: Either action action'
      action' = matching prism action

    in either (const state) (\a -> set lens (unwrap k a state') state) action'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant