diff options
Diffstat (limited to 'libraries/base/Data/Bitraversable.hs')
-rw-r--r-- | libraries/base/Data/Bitraversable.hs | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/libraries/base/Data/Bitraversable.hs b/libraries/base/Data/Bitraversable.hs index 169510844d..4064929890 100644 --- a/libraries/base/Data/Bitraversable.hs +++ b/libraries/base/Data/Bitraversable.hs @@ -52,8 +52,11 @@ import GHC.Generics (K1(..)) -- @'bitraverse' 'Identity' 'Identity' ≡ 'Identity'@ -- -- [/composition/] --- @'Compose' . 'fmap' ('bitraverse' g1 g2) . 'bitraverse' f1 f2 --- ≡ 'traverse' ('Compose' . 'fmap' g1 . f1) ('Compose' . 'fmap' g2 . f2)@ +-- @'Data.Functor.Compose.Compose' . +-- 'fmap' ('bitraverse' g1 g2) . +-- 'bitraverse' f1 f2 +-- ≡ 'traverse' ('Data.Functor.Compose.Compose' . 'fmap' g1 . f1) +-- ('Data.Functor.Compose.Compose' . 'fmap' g2 . f2)@ -- -- where an /applicative transformation/ is a function -- @@ -66,26 +69,9 @@ import GHC.Generics (K1(..)) -- t (f '<*>' x) = t f '<*>' t x -- @ -- --- and the identity functor 'Identity' and composition functors 'Compose' are --- defined as --- --- > newtype Identity a = Identity { runIdentity :: a } --- > --- > instance Functor Identity where --- > fmap f (Identity x) = Identity (f x) --- > --- > instance Applicative Identity where --- > pure = Identity --- > Identity f <*> Identity x = Identity (f x) --- > --- > newtype Compose f g a = Compose (f (g a)) --- > --- > instance (Functor f, Functor g) => Functor (Compose f g) where --- > fmap f (Compose x) = Compose (fmap (fmap f) x) --- > --- > instance (Applicative f, Applicative g) => Applicative (Compose f g) where --- > pure = Compose . pure . pure --- > Compose f <*> Compose x = Compose ((<*>) <$> f <*> x) +-- and the identity functor 'Identity' and composition functors +-- 'Data.Functor.Compose.Compose' are from "Data.Functor.Identity" and +-- "Data.Functor.Compose". -- -- Some simple examples are 'Either' and '(,)': -- |