bifunctors icon indicating copy to clipboard operation
bifunctors copied to clipboard

Add functions from Biff to Sum/Product/Lift

Open Icelandjack opened this issue 8 years ago • 0 comments

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

Icelandjack avatar Jan 24 '17 01:01 Icelandjack