-
Notifications
You must be signed in to change notification settings - Fork 52
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
add icompose #55
Comments
👍 Sounds good, although maybe the implementation could be simpler? |
i just looked at it again, and it's type is the original icompose specialized to IndexedTraversals. So the story for all the other indexed optics is missing. some more specialized combinators could be written, but what about combining an indexed lens with an indexed Traversal? I think some general combinator for IndexedOptics is needed. |
I think the following works, though it might be able to be simplified further. icompose :: forall p i j k s' t' s t a b. Profunctor p =>
(i -> j -> k) ->
IndexedOptic p i s' t' s t ->
IndexedOptic (Indexed p i) j s t a b ->
IndexedOptic p k s' t' a b
icompose f x y = x <<< y <<< Indexed <<< Indexed <<< lcmap (\(Tuple a (Tuple b c)) -> Tuple (f a b) c) <<< un Indexed |
i just found some functions that might be worth being added. But i don't really know where to add them and don't have the time to prepare a PR. So here we go:
icompose is inspired by
http://hackage.haskell.org/package/lens-4.15.1/docs/Control-Lens-Indexed.html#v:icompose
this way it's possible to combine IndexedTraversals:
The text was updated successfully, but these errors were encountered: