bifunctors
bifunctors copied to clipboard
Add functions from Biff to Sum/Product/Lift
Are any of these (/ inverses) useful
toSum :: Biff Either f g a a -> Sum f g a
toSum (Biff (Left fa)) = InL fa
toSum (Biff (Right ga)) = InR ga
toProduct :: Biff (,) f g a a -> Product f g a
toProduct (Biff (fa, ga)) = Pair fa ga
-- transformers
toLift :: Biff Either Identity g a a -> Lift g a
toLift (Biff (Left (Identity a))) = Pure a
toLift (Biff (Right ga)) = Other ga