-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
Is there any reason why Strong
/Choice
require second
/right
and not instead derive them from first
/left
?
secondBasedOnFirst :: forall p a b c. Strong p => p a b -> p (Tuple c a) (Tuple c b)
-- equivalent to `second`?
secondBasedOnFirst = dimap swap swap <<< first
where
swap :: forall x y. Tuple x y -> Tuple y x
swap (Tuple a b) = Tuple b a
rightBasedOnLeft :: forall p a b c. Choice p => p a b -> p (Either c a) (Either c b)
-- equivalent to `right`?
rightBasedOnLeft = dimap flip flip <<< left
where
flip :: forall x y. Either x y -> Either y x
flip (Left a) = Right a
flip (Right b) = Left b
Is this only because of lack of default type class member implementations feature in PureScript or is there any other reason?
Metadata
Metadata
Assignees
Labels
No labels