{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE TypeFamilies #-}

#if __GLASGOW_HASKELL__ >= 702
{-# LANGUAGE DeriveGeneric #-}
#endif

#if __GLASGOW_HASKELL__ >= 706
{-# LANGUAGE PolyKinds #-}
#endif

#if __GLASGOW_HASKELL__ >= 708
{-# LANGUAGE Safe #-}
#elif __GLASGOW_HASKELL__ >= 702
{-# LANGUAGE Trustworthy #-}
#endif
#include "bifunctors-common.h"

-----------------------------------------------------------------------------

-- |

-- Copyright   :  (C) 2008-2016 Edward Kmett

-- License     :  BSD-style (see the file LICENSE)

--

-- Maintainer  :  Edward Kmett <ekmett@gmail.com>

-- Stability   :  provisional

-- Portability :  portable

--

----------------------------------------------------------------------------

module Data.Bifunctor.Wrapped
  ( WrappedBifunctor(..)
  ) where

#if __GLASGOW_HASKELL__ < 710
import Control.Applicative
#endif

import Data.Biapplicative
import Data.Bifoldable
import Data.Bitraversable

#if __GLASGOW_HASKELL__ < 710
import Data.Foldable
import Data.Monoid
import Data.Traversable
#endif

#if __GLASGOW_HASKELL__ >= 708
import Data.Typeable
#endif

#if __GLASGOW_HASKELL__ >= 702
import GHC.Generics
#endif

#if LIFTED_FUNCTOR_CLASSES
import Data.Functor.Classes
#endif

-- | Make a 'Functor' over the second argument of a 'Bifunctor'.

newtype WrappedBifunctor p a b = WrapBifunctor { forall {k} {k} (p :: k -> k -> *) (a :: k) (b :: k).
WrappedBifunctor p a b -> p a b
unwrapBifunctor :: p a b }
  deriving ( WrappedBifunctor p a b -> WrappedBifunctor p a b -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Eq (p a b) =>
WrappedBifunctor p a b -> WrappedBifunctor p a b -> Bool
/= :: WrappedBifunctor p a b -> WrappedBifunctor p a b -> Bool
$c/= :: forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Eq (p a b) =>
WrappedBifunctor p a b -> WrappedBifunctor p a b -> Bool
== :: WrappedBifunctor p a b -> WrappedBifunctor p a b -> Bool
$c== :: forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Eq (p a b) =>
WrappedBifunctor p a b -> WrappedBifunctor p a b -> Bool
Eq, WrappedBifunctor p a b -> WrappedBifunctor p a b -> Bool
WrappedBifunctor p a b -> WrappedBifunctor p a b -> Ordering
WrappedBifunctor p a b
-> WrappedBifunctor p a b -> WrappedBifunctor p a b
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {k} {k} {p :: k -> k -> *} {a :: k} {b :: k}.
Ord (p a b) =>
Eq (WrappedBifunctor p a b)
forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Ord (p a b) =>
WrappedBifunctor p a b -> WrappedBifunctor p a b -> Bool
forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Ord (p a b) =>
WrappedBifunctor p a b -> WrappedBifunctor p a b -> Ordering
forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Ord (p a b) =>
WrappedBifunctor p a b
-> WrappedBifunctor p a b -> WrappedBifunctor p a b
min :: WrappedBifunctor p a b
-> WrappedBifunctor p a b -> WrappedBifunctor p a b
$cmin :: forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Ord (p a b) =>
WrappedBifunctor p a b
-> WrappedBifunctor p a b -> WrappedBifunctor p a b
max :: WrappedBifunctor p a b
-> WrappedBifunctor p a b -> WrappedBifunctor p a b
$cmax :: forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Ord (p a b) =>
WrappedBifunctor p a b
-> WrappedBifunctor p a b -> WrappedBifunctor p a b
>= :: WrappedBifunctor p a b -> WrappedBifunctor p a b -> Bool
$c>= :: forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Ord (p a b) =>
WrappedBifunctor p a b -> WrappedBifunctor p a b -> Bool
> :: WrappedBifunctor p a b -> WrappedBifunctor p a b -> Bool
$c> :: forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Ord (p a b) =>
WrappedBifunctor p a b -> WrappedBifunctor p a b -> Bool
<= :: WrappedBifunctor p a b -> WrappedBifunctor p a b -> Bool
$c<= :: forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Ord (p a b) =>
WrappedBifunctor p a b -> WrappedBifunctor p a b -> Bool
< :: WrappedBifunctor p a b -> WrappedBifunctor p a b -> Bool
$c< :: forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Ord (p a b) =>
WrappedBifunctor p a b -> WrappedBifunctor p a b -> Bool
compare :: WrappedBifunctor p a b -> WrappedBifunctor p a b -> Ordering
$ccompare :: forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Ord (p a b) =>
WrappedBifunctor p a b -> WrappedBifunctor p a b -> Ordering
Ord, Int -> WrappedBifunctor p a b -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Show (p a b) =>
Int -> WrappedBifunctor p a b -> ShowS
forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Show (p a b) =>
[WrappedBifunctor p a b] -> ShowS
forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Show (p a b) =>
WrappedBifunctor p a b -> String
showList :: [WrappedBifunctor p a b] -> ShowS
$cshowList :: forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Show (p a b) =>
[WrappedBifunctor p a b] -> ShowS
show :: WrappedBifunctor p a b -> String
$cshow :: forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Show (p a b) =>
WrappedBifunctor p a b -> String
showsPrec :: Int -> WrappedBifunctor p a b -> ShowS
$cshowsPrec :: forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Show (p a b) =>
Int -> WrappedBifunctor p a b -> ShowS
Show, ReadPrec [WrappedBifunctor p a b]
ReadPrec (WrappedBifunctor p a b)
ReadS [WrappedBifunctor p a b]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Read (p a b) =>
ReadPrec [WrappedBifunctor p a b]
forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Read (p a b) =>
ReadPrec (WrappedBifunctor p a b)
forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Read (p a b) =>
Int -> ReadS (WrappedBifunctor p a b)
forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Read (p a b) =>
ReadS [WrappedBifunctor p a b]
readListPrec :: ReadPrec [WrappedBifunctor p a b]
$creadListPrec :: forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Read (p a b) =>
ReadPrec [WrappedBifunctor p a b]
readPrec :: ReadPrec (WrappedBifunctor p a b)
$creadPrec :: forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Read (p a b) =>
ReadPrec (WrappedBifunctor p a b)
readList :: ReadS [WrappedBifunctor p a b]
$creadList :: forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Read (p a b) =>
ReadS [WrappedBifunctor p a b]
readsPrec :: Int -> ReadS (WrappedBifunctor p a b)
$creadsPrec :: forall k k (p :: k -> k -> *) (a :: k) (b :: k).
Read (p a b) =>
Int -> ReadS (WrappedBifunctor p a b)
Read
#if __GLASGOW_HASKELL__ >= 702
           , forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall k k (p :: k -> k -> *) (a :: k) (b :: k) x.
Rep (WrappedBifunctor p a b) x -> WrappedBifunctor p a b
forall k k (p :: k -> k -> *) (a :: k) (b :: k) x.
WrappedBifunctor p a b -> Rep (WrappedBifunctor p a b) x
$cto :: forall k k (p :: k -> k -> *) (a :: k) (b :: k) x.
Rep (WrappedBifunctor p a b) x -> WrappedBifunctor p a b
$cfrom :: forall k k (p :: k -> k -> *) (a :: k) (b :: k) x.
WrappedBifunctor p a b -> Rep (WrappedBifunctor p a b) x
Generic
#endif
#if __GLASGOW_HASKELL__ >= 708
           , forall k k (p :: k -> k -> *) (a :: k) (a :: k).
Rep1 (WrappedBifunctor p a) a -> WrappedBifunctor p a a
forall k k (p :: k -> k -> *) (a :: k) (a :: k).
WrappedBifunctor p a a -> Rep1 (WrappedBifunctor p a) a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall k k (p :: k -> k -> *) (a :: k) (a :: k).
Rep1 (WrappedBifunctor p a) a -> WrappedBifunctor p a a
$cfrom1 :: forall k k (p :: k -> k -> *) (a :: k) (a :: k).
WrappedBifunctor p a a -> Rep1 (WrappedBifunctor p a) a
Generic1
           , Typeable
#endif
           )

#if __GLASGOW_HASKELL__ >= 702 && __GLASGOW_HASKELL__ < 708
data WrappedBifunctorMetaData
data WrappedBifunctorMetaCons
data WrappedBifunctorMetaSel

instance Datatype WrappedBifunctorMetaData where
    datatypeName = const "WrappedBifunctor"
    moduleName = const "Data.Bifunctor.Wrapped"

instance Constructor WrappedBifunctorMetaCons where
    conName = const "WrapBifunctor"
    conIsRecord = const True

instance Selector WrappedBifunctorMetaSel where
    selName = const "unwrapBifunctor"

instance Generic1 (WrappedBifunctor p a) where
    type Rep1 (WrappedBifunctor p a) = D1 WrappedBifunctorMetaData
        (C1 WrappedBifunctorMetaCons
            (S1 WrappedBifunctorMetaSel (Rec1 (p a))))
    from1 = M1 . M1 . M1 . Rec1 . unwrapBifunctor
    to1 = WrapBifunctor . unRec1 . unM1 . unM1 . unM1
#endif

#if LIFTED_FUNCTOR_CLASSES
instance (Eq2 p, Eq a) => Eq1 (WrappedBifunctor p a) where
  liftEq :: forall a b.
(a -> b -> Bool)
-> WrappedBifunctor p a a -> WrappedBifunctor p a b -> Bool
liftEq = forall (f :: * -> * -> *) a b c d.
Eq2 f =>
(a -> b -> Bool) -> (c -> d -> Bool) -> f a c -> f b d -> Bool
liftEq2 forall a. Eq a => a -> a -> Bool
(==)
instance Eq2 p => Eq2 (WrappedBifunctor p) where
  liftEq2 :: forall a b c d.
(a -> b -> Bool)
-> (c -> d -> Bool)
-> WrappedBifunctor p a c
-> WrappedBifunctor p b d
-> Bool
liftEq2 a -> b -> Bool
f c -> d -> Bool
g (WrapBifunctor p a c
x) (WrapBifunctor p b d
y) = forall (f :: * -> * -> *) a b c d.
Eq2 f =>
(a -> b -> Bool) -> (c -> d -> Bool) -> f a c -> f b d -> Bool
liftEq2 a -> b -> Bool
f c -> d -> Bool
g p a c
x p b d
y

instance (Ord2 p, Ord a) => Ord1 (WrappedBifunctor p a) where
  liftCompare :: forall a b.
(a -> b -> Ordering)
-> WrappedBifunctor p a a -> WrappedBifunctor p a b -> Ordering
liftCompare = forall (f :: * -> * -> *) a b c d.
Ord2 f =>
(a -> b -> Ordering)
-> (c -> d -> Ordering) -> f a c -> f b d -> Ordering
liftCompare2 forall a. Ord a => a -> a -> Ordering
compare
instance Ord2 p => Ord2 (WrappedBifunctor p) where
  liftCompare2 :: forall a b c d.
(a -> b -> Ordering)
-> (c -> d -> Ordering)
-> WrappedBifunctor p a c
-> WrappedBifunctor p b d
-> Ordering
liftCompare2 a -> b -> Ordering
f c -> d -> Ordering
g (WrapBifunctor p a c
x) (WrapBifunctor p b d
y) = forall (f :: * -> * -> *) a b c d.
Ord2 f =>
(a -> b -> Ordering)
-> (c -> d -> Ordering) -> f a c -> f b d -> Ordering
liftCompare2 a -> b -> Ordering
f c -> d -> Ordering
g p a c
x p b d
y

instance (Read2 p, Read a) => Read1 (WrappedBifunctor p a) where
  liftReadsPrec :: forall a.
(Int -> ReadS a)
-> ReadS [a] -> Int -> ReadS (WrappedBifunctor p a a)
liftReadsPrec = forall (f :: * -> * -> *) a b.
Read2 f =>
(Int -> ReadS a)
-> ReadS [a]
-> (Int -> ReadS b)
-> ReadS [b]
-> Int
-> ReadS (f a b)
liftReadsPrec2 forall a. Read a => Int -> ReadS a
readsPrec forall a. Read a => ReadS [a]
readList
instance Read2 p => Read2 (WrappedBifunctor p) where
  liftReadsPrec2 :: forall a b.
(Int -> ReadS a)
-> ReadS [a]
-> (Int -> ReadS b)
-> ReadS [b]
-> Int
-> ReadS (WrappedBifunctor p a b)
liftReadsPrec2 Int -> ReadS a
rp1 ReadS [a]
rl1 Int -> ReadS b
rp2 ReadS [b]
rl2 Int
p = forall a. Bool -> ReadS a -> ReadS a
readParen (Int
p forall a. Ord a => a -> a -> Bool
> Int
10) forall a b. (a -> b) -> a -> b
$ \String
s0 -> do
    (String
"WrapBifunctor",   String
s1) <- ReadS String
lex String
s0
    (String
"{",               String
s2) <- ReadS String
lex String
s1
    (String
"unwrapBifunctor", String
s3) <- ReadS String
lex String
s2
    (p a b
x,                 String
s4) <- forall (f :: * -> * -> *) a b.
Read2 f =>
(Int -> ReadS a)
-> ReadS [a]
-> (Int -> ReadS b)
-> ReadS [b]
-> Int
-> ReadS (f a b)
liftReadsPrec2 Int -> ReadS a
rp1 ReadS [a]
rl1 Int -> ReadS b
rp2 ReadS [b]
rl2 Int
0 String
s3
    (String
"}",               String
s5) <- ReadS String
lex String
s4
    forall (m :: * -> *) a. Monad m => a -> m a
return (forall {k} {k} (p :: k -> k -> *) (a :: k) (b :: k).
p a b -> WrappedBifunctor p a b
WrapBifunctor p a b
x, String
s5)

instance (Show2 p, Show a) => Show1 (WrappedBifunctor p a) where
  liftShowsPrec :: forall a.
(Int -> a -> ShowS)
-> ([a] -> ShowS) -> Int -> WrappedBifunctor p a a -> ShowS
liftShowsPrec = forall (f :: * -> * -> *) a b.
Show2 f =>
(Int -> a -> ShowS)
-> ([a] -> ShowS)
-> (Int -> b -> ShowS)
-> ([b] -> ShowS)
-> Int
-> f a b
-> ShowS
liftShowsPrec2 forall a. Show a => Int -> a -> ShowS
showsPrec forall a. Show a => [a] -> ShowS
showList
instance Show2 p => Show2 (WrappedBifunctor p) where
  liftShowsPrec2 :: forall a b.
(Int -> a -> ShowS)
-> ([a] -> ShowS)
-> (Int -> b -> ShowS)
-> ([b] -> ShowS)
-> Int
-> WrappedBifunctor p a b
-> ShowS
liftShowsPrec2 Int -> a -> ShowS
sp1 [a] -> ShowS
sl1 Int -> b -> ShowS
sp2 [b] -> ShowS
sl2 Int
p (WrapBifunctor p a b
x) = Bool -> ShowS -> ShowS
showParen (Int
p forall a. Ord a => a -> a -> Bool
> Int
10) forall a b. (a -> b) -> a -> b
$
      String -> ShowS
showString String
"WrapBifunctor {unwrapBifunctor = "
    forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> * -> *) a b.
Show2 f =>
(Int -> a -> ShowS)
-> ([a] -> ShowS)
-> (Int -> b -> ShowS)
-> ([b] -> ShowS)
-> Int
-> f a b
-> ShowS
liftShowsPrec2 Int -> a -> ShowS
sp1 [a] -> ShowS
sl1 Int -> b -> ShowS
sp2 [b] -> ShowS
sl2 Int
0 p a b
x
    forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ShowS
showChar Char
'}'
#endif

instance Bifunctor p => Bifunctor (WrappedBifunctor p) where
  first :: forall a b c.
(a -> b) -> WrappedBifunctor p a c -> WrappedBifunctor p b c
first a -> b
f = forall {k} {k} (p :: k -> k -> *) (a :: k) (b :: k).
p a b -> WrappedBifunctor p a b
WrapBifunctor forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (p :: * -> * -> *) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first a -> b
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} {k} (p :: k -> k -> *) (a :: k) (b :: k).
WrappedBifunctor p a b -> p a b
unwrapBifunctor
  {-# INLINE first #-}
  second :: forall b c a.
(b -> c) -> WrappedBifunctor p a b -> WrappedBifunctor p a c
second b -> c
f = forall {k} {k} (p :: k -> k -> *) (a :: k) (b :: k).
p a b -> WrappedBifunctor p a b
WrapBifunctor forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (p :: * -> * -> *) b c a.
Bifunctor p =>
(b -> c) -> p a b -> p a c
second b -> c
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} {k} (p :: k -> k -> *) (a :: k) (b :: k).
WrappedBifunctor p a b -> p a b
unwrapBifunctor
  {-# INLINE second #-}
  bimap :: forall a b c d.
(a -> b)
-> (c -> d) -> WrappedBifunctor p a c -> WrappedBifunctor p b d
bimap a -> b
f c -> d
g = forall {k} {k} (p :: k -> k -> *) (a :: k) (b :: k).
p a b -> WrappedBifunctor p a b
WrapBifunctor forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (p :: * -> * -> *) a b c d.
Bifunctor p =>
(a -> b) -> (c -> d) -> p a c -> p b d
bimap a -> b
f c -> d
g forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} {k} (p :: k -> k -> *) (a :: k) (b :: k).
WrappedBifunctor p a b -> p a b
unwrapBifunctor
  {-# INLINE bimap #-}

instance Bifunctor p => Functor (WrappedBifunctor p a) where
  fmap :: forall a b.
(a -> b) -> WrappedBifunctor p a a -> WrappedBifunctor p a b
fmap a -> b
f = forall {k} {k} (p :: k -> k -> *) (a :: k) (b :: k).
p a b -> WrappedBifunctor p a b
WrapBifunctor forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (p :: * -> * -> *) b c a.
Bifunctor p =>
(b -> c) -> p a b -> p a c
second a -> b
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} {k} (p :: k -> k -> *) (a :: k) (b :: k).
WrappedBifunctor p a b -> p a b
unwrapBifunctor
  {-# INLINE fmap #-}

instance Biapplicative p => Biapplicative (WrappedBifunctor p) where
  bipure :: forall a b. a -> b -> WrappedBifunctor p a b
bipure a
a b
b = forall {k} {k} (p :: k -> k -> *) (a :: k) (b :: k).
p a b -> WrappedBifunctor p a b
WrapBifunctor (forall (p :: * -> * -> *) a b. Biapplicative p => a -> b -> p a b
bipure a
a b
b)
  {-# INLINE bipure #-}
  WrapBifunctor p (a -> b) (c -> d)
fg <<*>> :: forall a b c d.
WrappedBifunctor p (a -> b) (c -> d)
-> WrappedBifunctor p a c -> WrappedBifunctor p b d
<<*>> WrapBifunctor p a c
xy = forall {k} {k} (p :: k -> k -> *) (a :: k) (b :: k).
p a b -> WrappedBifunctor p a b
WrapBifunctor (p (a -> b) (c -> d)
fg forall (p :: * -> * -> *) a b c d.
Biapplicative p =>
p (a -> b) (c -> d) -> p a c -> p b d
<<*>> p a c
xy)
  {-# INLINE (<<*>>) #-}

instance Bifoldable p => Foldable (WrappedBifunctor p a) where
  foldMap :: forall m a. Monoid m => (a -> m) -> WrappedBifunctor p a a -> m
foldMap a -> m
f = forall (p :: * -> * -> *) m a b.
(Bifoldable p, Monoid m) =>
(a -> m) -> (b -> m) -> p a b -> m
bifoldMap (forall a b. a -> b -> a
const forall a. Monoid a => a
mempty) a -> m
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} {k} (p :: k -> k -> *) (a :: k) (b :: k).
WrappedBifunctor p a b -> p a b
unwrapBifunctor
  {-# INLINE foldMap #-}

instance Bifoldable p => Bifoldable (WrappedBifunctor p) where
  bifoldMap :: forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> WrappedBifunctor p a b -> m
bifoldMap a -> m
f b -> m
g = forall (p :: * -> * -> *) m a b.
(Bifoldable p, Monoid m) =>
(a -> m) -> (b -> m) -> p a b -> m
bifoldMap a -> m
f b -> m
g forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} {k} (p :: k -> k -> *) (a :: k) (b :: k).
WrappedBifunctor p a b -> p a b
unwrapBifunctor
  {-# INLINE bifoldMap #-}

instance Bitraversable p => Traversable (WrappedBifunctor p a) where
  traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> WrappedBifunctor p a a -> f (WrappedBifunctor p a b)
traverse a -> f b
f = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall {k} {k} (p :: k -> k -> *) (a :: k) (b :: k).
p a b -> WrappedBifunctor p a b
WrapBifunctor forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> * -> *) (f :: * -> *) a c b d.
(Bitraversable t, Applicative f) =>
(a -> f c) -> (b -> f d) -> t a b -> f (t c d)
bitraverse forall (f :: * -> *) a. Applicative f => a -> f a
pure a -> f b
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} {k} (p :: k -> k -> *) (a :: k) (b :: k).
WrappedBifunctor p a b -> p a b
unwrapBifunctor
  {-# INLINE traverse #-}

instance Bitraversable p => Bitraversable (WrappedBifunctor p) where
  bitraverse :: forall (f :: * -> *) a c b d.
Applicative f =>
(a -> f c)
-> (b -> f d)
-> WrappedBifunctor p a b
-> f (WrappedBifunctor p c d)
bitraverse a -> f c
f b -> f d
g = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall {k} {k} (p :: k -> k -> *) (a :: k) (b :: k).
p a b -> WrappedBifunctor p a b
WrapBifunctor forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> * -> *) (f :: * -> *) a c b d.
(Bitraversable t, Applicative f) =>
(a -> f c) -> (b -> f d) -> t a b -> f (t c d)
bitraverse a -> f c
f b -> f d
g forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} {k} (p :: k -> k -> *) (a :: k) (b :: k).
WrappedBifunctor p a b -> p a b
unwrapBifunctor
  {-# INLINE bitraverse #-}