category-extras-0.44.2: src/Control/Bifunctor/Biff.hs
-------------------------------------------------------------------------------------------
-- |
-- Module : Control.Bifunctor.Biff
-- Copyright : 2008 Edward Kmett
-- License : BSD3
--
-- Maintainer : Edward Kmett <ekmett@gmail.com>
-- Stability : experimental
-- Portability : portable
--
-------------------------------------------------------------------------------------------
module Control.Bifunctor.Biff
( module Control.Bifunctor.Monoidal
, BiffB(..)
) where
import Control.Bifunctor.Monoidal
newtype BiffB p f g a b = BiffB { runBiffB :: p (f a) (g b) }
instance (Functor f, Bifunctor p, Functor g) => Bifunctor (BiffB p f g) where
bimap f g = BiffB . bimap (fmap f) (fmap g) . runBiffB
instance (Functor f, Braided p) => Braided (BiffB p f f) where
braid = BiffB . braid . runBiffB
instance (Functor f, Symmetric p) => Symmetric (BiffB p f f)
instance (Functor f, Bifunctor p, Functor g) => Functor (BiffB p f g a) where
fmap f = bimap id f