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

Should firstTraversing and leftTraversing be defined in terms of wander? #48

Open
treeowl opened this issue Apr 2, 2017 · 0 comments
Open

Comments

@treeowl
Copy link
Contributor

treeowl commented Apr 2, 2017

Currently,

firstTraversing :: Traversing p => p a b -> p (a, c) (b, c)
firstTraversing = dimap swap swap . traverse'

leftTraversing :: Traversing p => p a b -> p (Either a c) (Either b c)
leftTraversing = dimap swapE swapE . traverse'

Would it be better or worse to use wander, or the same?

firstTraversing = wander $ \afb (a,c) -> (\a' -> (a', c)) <$> afb a
leftTraversing = wander $ \afb -> either (fmap Left . afb) (pure . Right)
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