Created
March 24, 2017 14:46
-
-
Save sjoerdvisscher/778b394f23da914dab33a82ea017538c to your computer and use it in GitHub Desktop.
wander for `Choice p, ProductProfunctor p`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- based on https://github.com/ekmett/profunctors/pull/40 | |
wander :: forall p a b s t. (Choice p, ProductProfunctor p) | |
=> (forall f. (Applicative f) => (a -> f b) -> s -> f t) | |
-> p a b -> p s t | |
wander tr p = lmap (runTrav . tr tLift) go where | |
go :: forall u. p (Coyo (TList a b) u) u | |
go = dimap unTList (either id id) . right' $ lmap fst go **** lmap snd p | |
-- This makes Costar Traversing and so also Strong! Bad idea, it just hangs when it's impossible to answer. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment