The generalization of Costar of Functor that is strong with respect to Either.
Note: This is also a notion of strength, except with regards to another monoidal structure that we can choose to equip Hask with: the cocartesian coproduct.
Methods
left' :: p a b -> p (Either a c) (Either b c)Laws:
left' ≡ dimap swapE swapE . right' where swapE :: Either a b -> Either b a swapE = either Right Left rmap Left ≡ lmap Left . left' lmap (right f) . left' ≡ rmap (right f) . left' left' . left' ≡ dimap assocE unassocE . left' where assocE :: Either (Either a b) c -> Either a (Either b c) assocE (Left (Left a)) = Left a assocE (Left (Right b)) = Right (Left b) assocE (Right c) = Right (Right c) unassocE :: Either a (Either b c) -> Either (Either a b) c unassocE (Left a) = Left (Left a) unassocE (Right (Left b)) = Left (Right b) unassocE (Right (Right c)) = Right cright' :: p a b -> p (Either c a) (Either c b)Laws:
right' ≡ dimap swapE swapE . left' where swapE :: Either a b -> Either b a swapE = either Right Left rmap Right ≡ lmap Right . right' lmap (left f) . right' ≡ rmap (left f) . right' right' . right' ≡ dimap unassocE assocE . right' where assocE :: Either (Either a b) c -> Either a (Either b c) assocE (Left (Left a)) = Left a assocE (Left (Right b)) = Right (Left b) assocE (Right c) = Right (Right c) unassocE :: Either a (Either b c) -> Either (Either a b) c unassocE (Left a) = Left (Left a) unassocE (Right (Left b)) = Left (Right b) unassocE (Right (Right c)) = Right c
Instances22Choice, …
Monad m => Choice (Kleisli m)Defined in profunctors-5.6.3 · Data.Profunctor.ChoiceChoice TaggedDefined in profunctors-5.6.3 · Data.Profunctor.ChoiceChoice (PastroSum p)Defined in profunctors-5.6.3 · Data.Profunctor.ChoiceChoice (FreeMapping p)Defined in profunctors-5.6.3 · Data.Profunctor.MappingChoice (FreeTraversing p)Defined in profunctors-5.6.3 · Data.Profunctor.TraversingChoice p => Choice (Tambara p)Defined in profunctors-5.6.3 · Data.Profunctor.ChoiceChoice p => Choice (Coyoneda p)Defined in profunctors-5.6.3 · Data.Profunctor.YonedaChoice p => Choice (Yoneda p)Defined in profunctors-5.6.3 · Data.Profunctor.YonedaProfunctor p => Choice (TambaraSum p)Defined in profunctors-5.6.3 · Data.Profunctor.ChoiceProfunctor p => Choice (CofreeMapping p)Defined in profunctors-5.6.3 · Data.Profunctor.MappingProfunctor p => Choice (CofreeTraversing p)Defined in profunctors-5.6.3 · Data.Profunctor.TraversingComonad w => Choice (Cokleisli w)Defined in profunctors-5.6.3 · Data.Profunctor.Choiceextract approximates
costrengthApplicative f => Choice (Star f)Defined in profunctors-5.6.3 · Data.Profunctor.ChoiceMonoid r => Choice (Forget r)Defined in profunctors-5.6.3 · Data.Profunctor.ChoiceChoice (->)Defined in profunctors-5.6.3 · Data.Profunctor.ChoiceFunctor f => Choice (Joker f)Defined in profunctors-5.6.3 · Data.Profunctor.ChoiceArrowChoice p => Choice (WrappedArrow p)Defined in profunctors-5.6.3 · Data.Profunctor.Choice(Choice p, Choice q) => Choice (Product p q)Defined in profunctors-5.6.3 · Data.Profunctor.Choice(Choice p, Choice q) => Choice (Sum p q)Defined in profunctors-5.6.3 · Data.Profunctor.Choice(Functor f, Choice p) => Choice (Tannen f p)Defined in profunctors-5.6.3 · Data.Profunctor.Choice(Functor f, Choice p) => Choice (Cayley f p)Defined in profunctors-5.6.3 · Data.Profunctor.Cayley(Choice p, Choice q) => Choice (Procompose p q)Defined in profunctors-5.6.3 · Data.Profunctor.Composition