{-# LANGUAGE CPP                        #-}
{-# LANGUAGE EmptyDataDecls             #-}
{-# LANGUAGE FlexibleContexts           #-}
{-# LANGUAGE DeriveTraversable          #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE ScopedTypeVariables        #-}
{-# LANGUAGE TypeFamilies               #-}

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

-- This module uses GND
#if __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.Biap
 ( Biap(..)
 ) where

import Control.Applicative
import Control.Monad
import qualified Control.Monad.Fail as Fail (MonadFail)
import Data.Biapplicative
import Data.Bifoldable
import Data.Bitraversable
import Data.Functor.Classes

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

#if !(MIN_VERSION_base(4,8,0))
import Data.Foldable
import Data.Monoid
import Data.Traversable
#endif

import qualified Data.Semigroup as S

-- | Pointwise lifting of a class over two arguments, using
-- 'Biapplicative'.
--
-- Classes that can be lifted include 'Monoid', 'Num' and
-- 'Bounded'. Each method of those classes can be defined as lifting
-- themselves over each argument of 'Biapplicative'.
--
-- @
-- mempty        = bipure mempty          mempty
-- minBound      = bipure minBound        minBound
-- maxBound      = bipure maxBound        maxBound
-- fromInteger n = bipure (fromInteger n) (fromInteger n)
--
-- negate = bimap negate negate
--
-- (+)  = biliftA2 (+)  (+)
-- (<>) = biliftA2 (<>) (<>)
-- @
--
-- 'Biap' is to 'Biapplicative' as 'Data.Monoid.Ap' is to
-- 'Applicative'.
--
-- 'Biap' can be used with @DerivingVia@ to derive a numeric instance
-- for pairs:
--
-- @
-- newtype Numpair a = Np (a, a)
--  deriving (S.Semigroup, Monoid, Num, Bounded)
--  via Biap (,) a a
-- @
--
newtype Biap bi a b = Biap { Biap bi a b -> bi a b
getBiap :: bi a b }
 deriving ( Biap bi a b -> Biap bi a b -> Bool
(Biap bi a b -> Biap bi a b -> Bool)
-> (Biap bi a b -> Biap bi a b -> Bool) -> Eq (Biap bi a b)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall (bi :: * -> * -> *) a b.
Eq (bi a b) =>
Biap bi a b -> Biap bi a b -> Bool
/= :: Biap bi a b -> Biap bi a b -> Bool
$c/= :: forall (bi :: * -> * -> *) a b.
Eq (bi a b) =>
Biap bi a b -> Biap bi a b -> Bool
== :: Biap bi a b -> Biap bi a b -> Bool
$c== :: forall (bi :: * -> * -> *) a b.
Eq (bi a b) =>
Biap bi a b -> Biap bi a b -> Bool
Eq
          , Eq (Biap bi a b)
Eq (Biap bi a b)
-> (Biap bi a b -> Biap bi a b -> Ordering)
-> (Biap bi a b -> Biap bi a b -> Bool)
-> (Biap bi a b -> Biap bi a b -> Bool)
-> (Biap bi a b -> Biap bi a b -> Bool)
-> (Biap bi a b -> Biap bi a b -> Bool)
-> (Biap bi a b -> Biap bi a b -> Biap bi a b)
-> (Biap bi a b -> Biap bi a b -> Biap bi a b)
-> Ord (Biap bi a b)
Biap bi a b -> Biap bi a b -> Bool
Biap bi a b -> Biap bi a b -> Ordering
Biap bi a b -> Biap bi a b -> Biap bi 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 (bi :: * -> * -> *) a b. Ord (bi a b) => Eq (Biap bi a b)
forall (bi :: * -> * -> *) a b.
Ord (bi a b) =>
Biap bi a b -> Biap bi a b -> Bool
forall (bi :: * -> * -> *) a b.
Ord (bi a b) =>
Biap bi a b -> Biap bi a b -> Ordering
forall (bi :: * -> * -> *) a b.
Ord (bi a b) =>
Biap bi a b -> Biap bi a b -> Biap bi a b
min :: Biap bi a b -> Biap bi a b -> Biap bi a b
$cmin :: forall (bi :: * -> * -> *) a b.
Ord (bi a b) =>
Biap bi a b -> Biap bi a b -> Biap bi a b
max :: Biap bi a b -> Biap bi a b -> Biap bi a b
$cmax :: forall (bi :: * -> * -> *) a b.
Ord (bi a b) =>
Biap bi a b -> Biap bi a b -> Biap bi a b
>= :: Biap bi a b -> Biap bi a b -> Bool
$c>= :: forall (bi :: * -> * -> *) a b.
Ord (bi a b) =>
Biap bi a b -> Biap bi a b -> Bool
> :: Biap bi a b -> Biap bi a b -> Bool
$c> :: forall (bi :: * -> * -> *) a b.
Ord (bi a b) =>
Biap bi a b -> Biap bi a b -> Bool
<= :: Biap bi a b -> Biap bi a b -> Bool
$c<= :: forall (bi :: * -> * -> *) a b.
Ord (bi a b) =>
Biap bi a b -> Biap bi a b -> Bool
< :: Biap bi a b -> Biap bi a b -> Bool
$c< :: forall (bi :: * -> * -> *) a b.
Ord (bi a b) =>
Biap bi a b -> Biap bi a b -> Bool
compare :: Biap bi a b -> Biap bi a b -> Ordering
$ccompare :: forall (bi :: * -> * -> *) a b.
Ord (bi a b) =>
Biap bi a b -> Biap bi a b -> Ordering
$cp1Ord :: forall (bi :: * -> * -> *) a b. Ord (bi a b) => Eq (Biap bi a b)
Ord
          , Int -> Biap bi a b -> ShowS
[Biap bi a b] -> ShowS
Biap bi a b -> String
(Int -> Biap bi a b -> ShowS)
-> (Biap bi a b -> String)
-> ([Biap bi a b] -> ShowS)
-> Show (Biap bi a b)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall (bi :: * -> * -> *) a b.
Show (bi a b) =>
Int -> Biap bi a b -> ShowS
forall (bi :: * -> * -> *) a b.
Show (bi a b) =>
[Biap bi a b] -> ShowS
forall (bi :: * -> * -> *) a b.
Show (bi a b) =>
Biap bi a b -> String
showList :: [Biap bi a b] -> ShowS
$cshowList :: forall (bi :: * -> * -> *) a b.
Show (bi a b) =>
[Biap bi a b] -> ShowS
show :: Biap bi a b -> String
$cshow :: forall (bi :: * -> * -> *) a b.
Show (bi a b) =>
Biap bi a b -> String
showsPrec :: Int -> Biap bi a b -> ShowS
$cshowsPrec :: forall (bi :: * -> * -> *) a b.
Show (bi a b) =>
Int -> Biap bi a b -> ShowS
Show
          , ReadPrec [Biap bi a b]
ReadPrec (Biap bi a b)
Int -> ReadS (Biap bi a b)
ReadS [Biap bi a b]
(Int -> ReadS (Biap bi a b))
-> ReadS [Biap bi a b]
-> ReadPrec (Biap bi a b)
-> ReadPrec [Biap bi a b]
-> Read (Biap bi a b)
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall (bi :: * -> * -> *) a b.
Read (bi a b) =>
ReadPrec [Biap bi a b]
forall (bi :: * -> * -> *) a b.
Read (bi a b) =>
ReadPrec (Biap bi a b)
forall (bi :: * -> * -> *) a b.
Read (bi a b) =>
Int -> ReadS (Biap bi a b)
forall (bi :: * -> * -> *) a b.
Read (bi a b) =>
ReadS [Biap bi a b]
readListPrec :: ReadPrec [Biap bi a b]
$creadListPrec :: forall (bi :: * -> * -> *) a b.
Read (bi a b) =>
ReadPrec [Biap bi a b]
readPrec :: ReadPrec (Biap bi a b)
$creadPrec :: forall (bi :: * -> * -> *) a b.
Read (bi a b) =>
ReadPrec (Biap bi a b)
readList :: ReadS [Biap bi a b]
$creadList :: forall (bi :: * -> * -> *) a b.
Read (bi a b) =>
ReadS [Biap bi a b]
readsPrec :: Int -> ReadS (Biap bi a b)
$creadsPrec :: forall (bi :: * -> * -> *) a b.
Read (bi a b) =>
Int -> ReadS (Biap bi a b)
Read
          , Int -> Biap bi a b
Biap bi a b -> Int
Biap bi a b -> [Biap bi a b]
Biap bi a b -> Biap bi a b
Biap bi a b -> Biap bi a b -> [Biap bi a b]
Biap bi a b -> Biap bi a b -> Biap bi a b -> [Biap bi a b]
(Biap bi a b -> Biap bi a b)
-> (Biap bi a b -> Biap bi a b)
-> (Int -> Biap bi a b)
-> (Biap bi a b -> Int)
-> (Biap bi a b -> [Biap bi a b])
-> (Biap bi a b -> Biap bi a b -> [Biap bi a b])
-> (Biap bi a b -> Biap bi a b -> [Biap bi a b])
-> (Biap bi a b -> Biap bi a b -> Biap bi a b -> [Biap bi a b])
-> Enum (Biap bi a b)
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
forall (bi :: * -> * -> *) a b. Enum (bi a b) => Int -> Biap bi a b
forall (bi :: * -> * -> *) a b. Enum (bi a b) => Biap bi a b -> Int
forall (bi :: * -> * -> *) a b.
Enum (bi a b) =>
Biap bi a b -> [Biap bi a b]
forall (bi :: * -> * -> *) a b.
Enum (bi a b) =>
Biap bi a b -> Biap bi a b
forall (bi :: * -> * -> *) a b.
Enum (bi a b) =>
Biap bi a b -> Biap bi a b -> [Biap bi a b]
forall (bi :: * -> * -> *) a b.
Enum (bi a b) =>
Biap bi a b -> Biap bi a b -> Biap bi a b -> [Biap bi a b]
enumFromThenTo :: Biap bi a b -> Biap bi a b -> Biap bi a b -> [Biap bi a b]
$cenumFromThenTo :: forall (bi :: * -> * -> *) a b.
Enum (bi a b) =>
Biap bi a b -> Biap bi a b -> Biap bi a b -> [Biap bi a b]
enumFromTo :: Biap bi a b -> Biap bi a b -> [Biap bi a b]
$cenumFromTo :: forall (bi :: * -> * -> *) a b.
Enum (bi a b) =>
Biap bi a b -> Biap bi a b -> [Biap bi a b]
enumFromThen :: Biap bi a b -> Biap bi a b -> [Biap bi a b]
$cenumFromThen :: forall (bi :: * -> * -> *) a b.
Enum (bi a b) =>
Biap bi a b -> Biap bi a b -> [Biap bi a b]
enumFrom :: Biap bi a b -> [Biap bi a b]
$cenumFrom :: forall (bi :: * -> * -> *) a b.
Enum (bi a b) =>
Biap bi a b -> [Biap bi a b]
fromEnum :: Biap bi a b -> Int
$cfromEnum :: forall (bi :: * -> * -> *) a b. Enum (bi a b) => Biap bi a b -> Int
toEnum :: Int -> Biap bi a b
$ctoEnum :: forall (bi :: * -> * -> *) a b. Enum (bi a b) => Int -> Biap bi a b
pred :: Biap bi a b -> Biap bi a b
$cpred :: forall (bi :: * -> * -> *) a b.
Enum (bi a b) =>
Biap bi a b -> Biap bi a b
succ :: Biap bi a b -> Biap bi a b
$csucc :: forall (bi :: * -> * -> *) a b.
Enum (bi a b) =>
Biap bi a b -> Biap bi a b
Enum
          , a -> Biap bi a b -> Biap bi a a
(a -> b) -> Biap bi a a -> Biap bi a b
(forall a b. (a -> b) -> Biap bi a a -> Biap bi a b)
-> (forall a b. a -> Biap bi a b -> Biap bi a a)
-> Functor (Biap bi a)
forall a b. a -> Biap bi a b -> Biap bi a a
forall a b. (a -> b) -> Biap bi a a -> Biap bi a b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
forall (bi :: * -> * -> *) a a b.
Functor (bi a) =>
a -> Biap bi a b -> Biap bi a a
forall (bi :: * -> * -> *) a a b.
Functor (bi a) =>
(a -> b) -> Biap bi a a -> Biap bi a b
<$ :: a -> Biap bi a b -> Biap bi a a
$c<$ :: forall (bi :: * -> * -> *) a a b.
Functor (bi a) =>
a -> Biap bi a b -> Biap bi a a
fmap :: (a -> b) -> Biap bi a a -> Biap bi a b
$cfmap :: forall (bi :: * -> * -> *) a a b.
Functor (bi a) =>
(a -> b) -> Biap bi a a -> Biap bi a b
Functor
          , a -> Biap bi a a -> Bool
Biap bi a m -> m
Biap bi a a -> [a]
Biap bi a a -> Bool
Biap bi a a -> Int
Biap bi a a -> a
Biap bi a a -> a
Biap bi a a -> a
Biap bi a a -> a
(a -> m) -> Biap bi a a -> m
(a -> m) -> Biap bi a a -> m
(a -> b -> b) -> b -> Biap bi a a -> b
(a -> b -> b) -> b -> Biap bi a a -> b
(b -> a -> b) -> b -> Biap bi a a -> b
(b -> a -> b) -> b -> Biap bi a a -> b
(a -> a -> a) -> Biap bi a a -> a
(a -> a -> a) -> Biap bi a a -> a
(forall m. Monoid m => Biap bi a m -> m)
-> (forall m a. Monoid m => (a -> m) -> Biap bi a a -> m)
-> (forall m a. Monoid m => (a -> m) -> Biap bi a a -> m)
-> (forall a b. (a -> b -> b) -> b -> Biap bi a a -> b)
-> (forall a b. (a -> b -> b) -> b -> Biap bi a a -> b)
-> (forall b a. (b -> a -> b) -> b -> Biap bi a a -> b)
-> (forall b a. (b -> a -> b) -> b -> Biap bi a a -> b)
-> (forall a. (a -> a -> a) -> Biap bi a a -> a)
-> (forall a. (a -> a -> a) -> Biap bi a a -> a)
-> (forall a. Biap bi a a -> [a])
-> (forall a. Biap bi a a -> Bool)
-> (forall a. Biap bi a a -> Int)
-> (forall a. Eq a => a -> Biap bi a a -> Bool)
-> (forall a. Ord a => Biap bi a a -> a)
-> (forall a. Ord a => Biap bi a a -> a)
-> (forall a. Num a => Biap bi a a -> a)
-> (forall a. Num a => Biap bi a a -> a)
-> Foldable (Biap bi a)
forall a. Eq a => a -> Biap bi a a -> Bool
forall a. Num a => Biap bi a a -> a
forall a. Ord a => Biap bi a a -> a
forall m. Monoid m => Biap bi a m -> m
forall a. Biap bi a a -> Bool
forall a. Biap bi a a -> Int
forall a. Biap bi a a -> [a]
forall a. (a -> a -> a) -> Biap bi a a -> a
forall m a. Monoid m => (a -> m) -> Biap bi a a -> m
forall b a. (b -> a -> b) -> b -> Biap bi a a -> b
forall a b. (a -> b -> b) -> b -> Biap bi a a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
forall (bi :: * -> * -> *) a a.
(Foldable (bi a), Eq a) =>
a -> Biap bi a a -> Bool
forall (bi :: * -> * -> *) a a.
(Foldable (bi a), Num a) =>
Biap bi a a -> a
forall (bi :: * -> * -> *) a a.
(Foldable (bi a), Ord a) =>
Biap bi a a -> a
forall (bi :: * -> * -> *) a m.
(Foldable (bi a), Monoid m) =>
Biap bi a m -> m
forall (bi :: * -> * -> *) a a.
Foldable (bi a) =>
Biap bi a a -> Bool
forall (bi :: * -> * -> *) a a.
Foldable (bi a) =>
Biap bi a a -> Int
forall (bi :: * -> * -> *) a a.
Foldable (bi a) =>
Biap bi a a -> [a]
forall (bi :: * -> * -> *) a a.
Foldable (bi a) =>
(a -> a -> a) -> Biap bi a a -> a
forall (bi :: * -> * -> *) a m a.
(Foldable (bi a), Monoid m) =>
(a -> m) -> Biap bi a a -> m
forall (bi :: * -> * -> *) a b a.
Foldable (bi a) =>
(b -> a -> b) -> b -> Biap bi a a -> b
forall (bi :: * -> * -> *) a a b.
Foldable (bi a) =>
(a -> b -> b) -> b -> Biap bi a a -> b
product :: Biap bi a a -> a
$cproduct :: forall (bi :: * -> * -> *) a a.
(Foldable (bi a), Num a) =>
Biap bi a a -> a
sum :: Biap bi a a -> a
$csum :: forall (bi :: * -> * -> *) a a.
(Foldable (bi a), Num a) =>
Biap bi a a -> a
minimum :: Biap bi a a -> a
$cminimum :: forall (bi :: * -> * -> *) a a.
(Foldable (bi a), Ord a) =>
Biap bi a a -> a
maximum :: Biap bi a a -> a
$cmaximum :: forall (bi :: * -> * -> *) a a.
(Foldable (bi a), Ord a) =>
Biap bi a a -> a
elem :: a -> Biap bi a a -> Bool
$celem :: forall (bi :: * -> * -> *) a a.
(Foldable (bi a), Eq a) =>
a -> Biap bi a a -> Bool
length :: Biap bi a a -> Int
$clength :: forall (bi :: * -> * -> *) a a.
Foldable (bi a) =>
Biap bi a a -> Int
null :: Biap bi a a -> Bool
$cnull :: forall (bi :: * -> * -> *) a a.
Foldable (bi a) =>
Biap bi a a -> Bool
toList :: Biap bi a a -> [a]
$ctoList :: forall (bi :: * -> * -> *) a a.
Foldable (bi a) =>
Biap bi a a -> [a]
foldl1 :: (a -> a -> a) -> Biap bi a a -> a
$cfoldl1 :: forall (bi :: * -> * -> *) a a.
Foldable (bi a) =>
(a -> a -> a) -> Biap bi a a -> a
foldr1 :: (a -> a -> a) -> Biap bi a a -> a
$cfoldr1 :: forall (bi :: * -> * -> *) a a.
Foldable (bi a) =>
(a -> a -> a) -> Biap bi a a -> a
foldl' :: (b -> a -> b) -> b -> Biap bi a a -> b
$cfoldl' :: forall (bi :: * -> * -> *) a b a.
Foldable (bi a) =>
(b -> a -> b) -> b -> Biap bi a a -> b
foldl :: (b -> a -> b) -> b -> Biap bi a a -> b
$cfoldl :: forall (bi :: * -> * -> *) a b a.
Foldable (bi a) =>
(b -> a -> b) -> b -> Biap bi a a -> b
foldr' :: (a -> b -> b) -> b -> Biap bi a a -> b
$cfoldr' :: forall (bi :: * -> * -> *) a a b.
Foldable (bi a) =>
(a -> b -> b) -> b -> Biap bi a a -> b
foldr :: (a -> b -> b) -> b -> Biap bi a a -> b
$cfoldr :: forall (bi :: * -> * -> *) a a b.
Foldable (bi a) =>
(a -> b -> b) -> b -> Biap bi a a -> b
foldMap' :: (a -> m) -> Biap bi a a -> m
$cfoldMap' :: forall (bi :: * -> * -> *) a m a.
(Foldable (bi a), Monoid m) =>
(a -> m) -> Biap bi a a -> m
foldMap :: (a -> m) -> Biap bi a a -> m
$cfoldMap :: forall (bi :: * -> * -> *) a m a.
(Foldable (bi a), Monoid m) =>
(a -> m) -> Biap bi a a -> m
fold :: Biap bi a m -> m
$cfold :: forall (bi :: * -> * -> *) a m.
(Foldable (bi a), Monoid m) =>
Biap bi a m -> m
Foldable
          , Functor (Biap bi a)
Foldable (Biap bi a)
Functor (Biap bi a)
-> Foldable (Biap bi a)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Biap bi a a -> f (Biap bi a b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    Biap bi a (f a) -> f (Biap bi a a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Biap bi a a -> m (Biap bi a b))
-> (forall (m :: * -> *) a.
    Monad m =>
    Biap bi a (m a) -> m (Biap bi a a))
-> Traversable (Biap bi a)
(a -> f b) -> Biap bi a a -> f (Biap bi a b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
Biap bi a (m a) -> m (Biap bi a a)
forall (f :: * -> *) a.
Applicative f =>
Biap bi a (f a) -> f (Biap bi a a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Biap bi a a -> m (Biap bi a b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Biap bi a a -> f (Biap bi a b)
forall (bi :: * -> * -> *) a.
Traversable (bi a) =>
Functor (Biap bi a)
forall (bi :: * -> * -> *) a.
Traversable (bi a) =>
Foldable (Biap bi a)
forall (bi :: * -> * -> *) a (m :: * -> *) a.
(Traversable (bi a), Monad m) =>
Biap bi a (m a) -> m (Biap bi a a)
forall (bi :: * -> * -> *) a (f :: * -> *) a.
(Traversable (bi a), Applicative f) =>
Biap bi a (f a) -> f (Biap bi a a)
forall (bi :: * -> * -> *) a (m :: * -> *) a b.
(Traversable (bi a), Monad m) =>
(a -> m b) -> Biap bi a a -> m (Biap bi a b)
forall (bi :: * -> * -> *) a (f :: * -> *) a b.
(Traversable (bi a), Applicative f) =>
(a -> f b) -> Biap bi a a -> f (Biap bi a b)
sequence :: Biap bi a (m a) -> m (Biap bi a a)
$csequence :: forall (bi :: * -> * -> *) a (m :: * -> *) a.
(Traversable (bi a), Monad m) =>
Biap bi a (m a) -> m (Biap bi a a)
mapM :: (a -> m b) -> Biap bi a a -> m (Biap bi a b)
$cmapM :: forall (bi :: * -> * -> *) a (m :: * -> *) a b.
(Traversable (bi a), Monad m) =>
(a -> m b) -> Biap bi a a -> m (Biap bi a b)
sequenceA :: Biap bi a (f a) -> f (Biap bi a a)
$csequenceA :: forall (bi :: * -> * -> *) a (f :: * -> *) a.
(Traversable (bi a), Applicative f) =>
Biap bi a (f a) -> f (Biap bi a a)
traverse :: (a -> f b) -> Biap bi a a -> f (Biap bi a b)
$ctraverse :: forall (bi :: * -> * -> *) a (f :: * -> *) a b.
(Traversable (bi a), Applicative f) =>
(a -> f b) -> Biap bi a a -> f (Biap bi a b)
$cp2Traversable :: forall (bi :: * -> * -> *) a.
Traversable (bi a) =>
Foldable (Biap bi a)
$cp1Traversable :: forall (bi :: * -> * -> *) a.
Traversable (bi a) =>
Functor (Biap bi a)
Traversable
          , Applicative (Biap bi a)
Biap bi a a
Applicative (Biap bi a)
-> (forall a. Biap bi a a)
-> (forall a. Biap bi a a -> Biap bi a a -> Biap bi a a)
-> (forall a. Biap bi a a -> Biap bi a [a])
-> (forall a. Biap bi a a -> Biap bi a [a])
-> Alternative (Biap bi a)
Biap bi a a -> Biap bi a a -> Biap bi a a
Biap bi a a -> Biap bi a [a]
Biap bi a a -> Biap bi a [a]
forall a. Biap bi a a
forall a. Biap bi a a -> Biap bi a [a]
forall a. Biap bi a a -> Biap bi a a -> Biap bi a a
forall (f :: * -> *).
Applicative f
-> (forall a. f a)
-> (forall a. f a -> f a -> f a)
-> (forall a. f a -> f [a])
-> (forall a. f a -> f [a])
-> Alternative f
forall (bi :: * -> * -> *) a.
Alternative (bi a) =>
Applicative (Biap bi a)
forall (bi :: * -> * -> *) a a. Alternative (bi a) => Biap bi a a
forall (bi :: * -> * -> *) a a.
Alternative (bi a) =>
Biap bi a a -> Biap bi a [a]
forall (bi :: * -> * -> *) a a.
Alternative (bi a) =>
Biap bi a a -> Biap bi a a -> Biap bi a a
many :: Biap bi a a -> Biap bi a [a]
$cmany :: forall (bi :: * -> * -> *) a a.
Alternative (bi a) =>
Biap bi a a -> Biap bi a [a]
some :: Biap bi a a -> Biap bi a [a]
$csome :: forall (bi :: * -> * -> *) a a.
Alternative (bi a) =>
Biap bi a a -> Biap bi a [a]
<|> :: Biap bi a a -> Biap bi a a -> Biap bi a a
$c<|> :: forall (bi :: * -> * -> *) a a.
Alternative (bi a) =>
Biap bi a a -> Biap bi a a -> Biap bi a a
empty :: Biap bi a a
$cempty :: forall (bi :: * -> * -> *) a a. Alternative (bi a) => Biap bi a a
$cp1Alternative :: forall (bi :: * -> * -> *) a.
Alternative (bi a) =>
Applicative (Biap bi a)
Alternative
          , Functor (Biap bi a)
a -> Biap bi a a
Functor (Biap bi a)
-> (forall a. a -> Biap bi a a)
-> (forall a b. Biap bi a (a -> b) -> Biap bi a a -> Biap bi a b)
-> (forall a b c.
    (a -> b -> c) -> Biap bi a a -> Biap bi a b -> Biap bi a c)
-> (forall a b. Biap bi a a -> Biap bi a b -> Biap bi a b)
-> (forall a b. Biap bi a a -> Biap bi a b -> Biap bi a a)
-> Applicative (Biap bi a)
Biap bi a a -> Biap bi a b -> Biap bi a b
Biap bi a a -> Biap bi a b -> Biap bi a a
Biap bi a (a -> b) -> Biap bi a a -> Biap bi a b
(a -> b -> c) -> Biap bi a a -> Biap bi a b -> Biap bi a c
forall a. a -> Biap bi a a
forall a b. Biap bi a a -> Biap bi a b -> Biap bi a a
forall a b. Biap bi a a -> Biap bi a b -> Biap bi a b
forall a b. Biap bi a (a -> b) -> Biap bi a a -> Biap bi a b
forall a b c.
(a -> b -> c) -> Biap bi a a -> Biap bi a b -> Biap bi a c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
forall (bi :: * -> * -> *) a.
Applicative (bi a) =>
Functor (Biap bi a)
forall (bi :: * -> * -> *) a a.
Applicative (bi a) =>
a -> Biap bi a a
forall (bi :: * -> * -> *) a a b.
Applicative (bi a) =>
Biap bi a a -> Biap bi a b -> Biap bi a a
forall (bi :: * -> * -> *) a a b.
Applicative (bi a) =>
Biap bi a a -> Biap bi a b -> Biap bi a b
forall (bi :: * -> * -> *) a a b.
Applicative (bi a) =>
Biap bi a (a -> b) -> Biap bi a a -> Biap bi a b
forall (bi :: * -> * -> *) a a b c.
Applicative (bi a) =>
(a -> b -> c) -> Biap bi a a -> Biap bi a b -> Biap bi a c
<* :: Biap bi a a -> Biap bi a b -> Biap bi a a
$c<* :: forall (bi :: * -> * -> *) a a b.
Applicative (bi a) =>
Biap bi a a -> Biap bi a b -> Biap bi a a
*> :: Biap bi a a -> Biap bi a b -> Biap bi a b
$c*> :: forall (bi :: * -> * -> *) a a b.
Applicative (bi a) =>
Biap bi a a -> Biap bi a b -> Biap bi a b
liftA2 :: (a -> b -> c) -> Biap bi a a -> Biap bi a b -> Biap bi a c
$cliftA2 :: forall (bi :: * -> * -> *) a a b c.
Applicative (bi a) =>
(a -> b -> c) -> Biap bi a a -> Biap bi a b -> Biap bi a c
<*> :: Biap bi a (a -> b) -> Biap bi a a -> Biap bi a b
$c<*> :: forall (bi :: * -> * -> *) a a b.
Applicative (bi a) =>
Biap bi a (a -> b) -> Biap bi a a -> Biap bi a b
pure :: a -> Biap bi a a
$cpure :: forall (bi :: * -> * -> *) a a.
Applicative (bi a) =>
a -> Biap bi a a
$cp1Applicative :: forall (bi :: * -> * -> *) a.
Applicative (bi a) =>
Functor (Biap bi a)
Applicative
#if __GLASGOW_HASKELL__ >= 702
          , (forall x. Biap bi a b -> Rep (Biap bi a b) x)
-> (forall x. Rep (Biap bi a b) x -> Biap bi a b)
-> Generic (Biap bi a b)
forall x. Rep (Biap bi a b) x -> Biap bi a b
forall x. Biap bi a b -> Rep (Biap bi a b) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (bi :: * -> * -> *) a b x.
Rep (Biap bi a b) x -> Biap bi a b
forall (bi :: * -> * -> *) a b x.
Biap bi a b -> Rep (Biap bi a b) x
$cto :: forall (bi :: * -> * -> *) a b x.
Rep (Biap bi a b) x -> Biap bi a b
$cfrom :: forall (bi :: * -> * -> *) a b x.
Biap bi a b -> Rep (Biap bi a b) x
Generic
#endif
#if __GLASGOW_HASKELL__ >= 706
          , (forall a. Biap bi a a -> Rep1 (Biap bi a) a)
-> (forall a. Rep1 (Biap bi a) a -> Biap bi a a)
-> Generic1 (Biap bi a)
forall a. Rep1 (Biap bi a) a -> Biap bi a a
forall a. Biap bi a a -> Rep1 (Biap bi a) a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
forall (bi :: * -> * -> *) a a. Rep1 (Biap bi a) a -> Biap bi a a
forall (bi :: * -> * -> *) a a. Biap bi a a -> Rep1 (Biap bi a) a
$cto1 :: forall (bi :: * -> * -> *) a a. Rep1 (Biap bi a) a -> Biap bi a a
$cfrom1 :: forall (bi :: * -> * -> *) a a. Biap bi a a -> Rep1 (Biap bi a) a
Generic1
#endif
          , Applicative (Biap bi a)
a -> Biap bi a a
Applicative (Biap bi a)
-> (forall a b. Biap bi a a -> (a -> Biap bi a b) -> Biap bi a b)
-> (forall a b. Biap bi a a -> Biap bi a b -> Biap bi a b)
-> (forall a. a -> Biap bi a a)
-> Monad (Biap bi a)
Biap bi a a -> (a -> Biap bi a b) -> Biap bi a b
Biap bi a a -> Biap bi a b -> Biap bi a b
forall a. a -> Biap bi a a
forall a b. Biap bi a a -> Biap bi a b -> Biap bi a b
forall a b. Biap bi a a -> (a -> Biap bi a b) -> Biap bi a b
forall (m :: * -> *).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
forall (bi :: * -> * -> *) a.
Monad (bi a) =>
Applicative (Biap bi a)
forall (bi :: * -> * -> *) a a. Monad (bi a) => a -> Biap bi a a
forall (bi :: * -> * -> *) a a b.
Monad (bi a) =>
Biap bi a a -> Biap bi a b -> Biap bi a b
forall (bi :: * -> * -> *) a a b.
Monad (bi a) =>
Biap bi a a -> (a -> Biap bi a b) -> Biap bi a b
return :: a -> Biap bi a a
$creturn :: forall (bi :: * -> * -> *) a a. Monad (bi a) => a -> Biap bi a a
>> :: Biap bi a a -> Biap bi a b -> Biap bi a b
$c>> :: forall (bi :: * -> * -> *) a a b.
Monad (bi a) =>
Biap bi a a -> Biap bi a b -> Biap bi a b
>>= :: Biap bi a a -> (a -> Biap bi a b) -> Biap bi a b
$c>>= :: forall (bi :: * -> * -> *) a a b.
Monad (bi a) =>
Biap bi a a -> (a -> Biap bi a b) -> Biap bi a b
$cp1Monad :: forall (bi :: * -> * -> *) a.
Monad (bi a) =>
Applicative (Biap bi a)
Monad
          , Monad (Biap bi a)
Monad (Biap bi a)
-> (forall a. String -> Biap bi a a) -> MonadFail (Biap bi a)
String -> Biap bi a a
forall a. String -> Biap bi a a
forall (m :: * -> *).
Monad m -> (forall a. String -> m a) -> MonadFail m
forall (bi :: * -> * -> *) a. MonadFail (bi a) => Monad (Biap bi a)
forall (bi :: * -> * -> *) a a.
MonadFail (bi a) =>
String -> Biap bi a a
fail :: String -> Biap bi a a
$cfail :: forall (bi :: * -> * -> *) a a.
MonadFail (bi a) =>
String -> Biap bi a a
$cp1MonadFail :: forall (bi :: * -> * -> *) a. MonadFail (bi a) => Monad (Biap bi a)
Fail.MonadFail
          , Monad (Biap bi a)
Alternative (Biap bi a)
Biap bi a a
Alternative (Biap bi a)
-> Monad (Biap bi a)
-> (forall a. Biap bi a a)
-> (forall a. Biap bi a a -> Biap bi a a -> Biap bi a a)
-> MonadPlus (Biap bi a)
Biap bi a a -> Biap bi a a -> Biap bi a a
forall a. Biap bi a a
forall a. Biap bi a a -> Biap bi a a -> Biap bi a a
forall (m :: * -> *).
Alternative m
-> Monad m
-> (forall a. m a)
-> (forall a. m a -> m a -> m a)
-> MonadPlus m
forall (bi :: * -> * -> *) a. MonadPlus (bi a) => Monad (Biap bi a)
forall (bi :: * -> * -> *) a.
MonadPlus (bi a) =>
Alternative (Biap bi a)
forall (bi :: * -> * -> *) a a. MonadPlus (bi a) => Biap bi a a
forall (bi :: * -> * -> *) a a.
MonadPlus (bi a) =>
Biap bi a a -> Biap bi a a -> Biap bi a a
mplus :: Biap bi a a -> Biap bi a a -> Biap bi a a
$cmplus :: forall (bi :: * -> * -> *) a a.
MonadPlus (bi a) =>
Biap bi a a -> Biap bi a a -> Biap bi a a
mzero :: Biap bi a a
$cmzero :: forall (bi :: * -> * -> *) a a. MonadPlus (bi a) => Biap bi a a
$cp2MonadPlus :: forall (bi :: * -> * -> *) a. MonadPlus (bi a) => Monad (Biap bi a)
$cp1MonadPlus :: forall (bi :: * -> * -> *) a.
MonadPlus (bi a) =>
Alternative (Biap bi a)
MonadPlus
          , (a -> b -> Bool) -> Biap bi a a -> Biap bi a b -> Bool
(forall a b.
 (a -> b -> Bool) -> Biap bi a a -> Biap bi a b -> Bool)
-> Eq1 (Biap bi a)
forall a b. (a -> b -> Bool) -> Biap bi a a -> Biap bi a b -> Bool
forall (f :: * -> *).
(forall a b. (a -> b -> Bool) -> f a -> f b -> Bool) -> Eq1 f
forall (bi :: * -> * -> *) a a b.
Eq1 (bi a) =>
(a -> b -> Bool) -> Biap bi a a -> Biap bi a b -> Bool
liftEq :: (a -> b -> Bool) -> Biap bi a a -> Biap bi a b -> Bool
$cliftEq :: forall (bi :: * -> * -> *) a a b.
Eq1 (bi a) =>
(a -> b -> Bool) -> Biap bi a a -> Biap bi a b -> Bool
Eq1
          , Eq1 (Biap bi a)
Eq1 (Biap bi a)
-> (forall a b.
    (a -> b -> Ordering) -> Biap bi a a -> Biap bi a b -> Ordering)
-> Ord1 (Biap bi a)
(a -> b -> Ordering) -> Biap bi a a -> Biap bi a b -> Ordering
forall a b.
(a -> b -> Ordering) -> Biap bi a a -> Biap bi a b -> Ordering
forall (f :: * -> *).
Eq1 f
-> (forall a b. (a -> b -> Ordering) -> f a -> f b -> Ordering)
-> Ord1 f
forall (bi :: * -> * -> *) a. Ord1 (bi a) => Eq1 (Biap bi a)
forall (bi :: * -> * -> *) a a b.
Ord1 (bi a) =>
(a -> b -> Ordering) -> Biap bi a a -> Biap bi a b -> Ordering
liftCompare :: (a -> b -> Ordering) -> Biap bi a a -> Biap bi a b -> Ordering
$cliftCompare :: forall (bi :: * -> * -> *) a a b.
Ord1 (bi a) =>
(a -> b -> Ordering) -> Biap bi a a -> Biap bi a b -> Ordering
$cp1Ord1 :: forall (bi :: * -> * -> *) a. Ord1 (bi a) => Eq1 (Biap bi a)
Ord1

          , (a -> b) -> (c -> d) -> Biap bi a c -> Biap bi b d
(a -> b) -> Biap bi a c -> Biap bi b c
(b -> c) -> Biap bi a b -> Biap bi a c
(forall a b c d.
 (a -> b) -> (c -> d) -> Biap bi a c -> Biap bi b d)
-> (forall a b c. (a -> b) -> Biap bi a c -> Biap bi b c)
-> (forall b c a. (b -> c) -> Biap bi a b -> Biap bi a c)
-> Bifunctor (Biap bi)
forall a b c. (a -> b) -> Biap bi a c -> Biap bi b c
forall b c a. (b -> c) -> Biap bi a b -> Biap bi a c
forall a b c d. (a -> b) -> (c -> d) -> Biap bi a c -> Biap bi b d
forall (bi :: * -> * -> *) a b c.
Bifunctor bi =>
(a -> b) -> Biap bi a c -> Biap bi b c
forall (bi :: * -> * -> *) b c a.
Bifunctor bi =>
(b -> c) -> Biap bi a b -> Biap bi a c
forall (bi :: * -> * -> *) a b c d.
Bifunctor bi =>
(a -> b) -> (c -> d) -> Biap bi a c -> Biap bi b d
forall (p :: * -> * -> *).
(forall a b c d. (a -> b) -> (c -> d) -> p a c -> p b d)
-> (forall a b c. (a -> b) -> p a c -> p b c)
-> (forall b c a. (b -> c) -> p a b -> p a c)
-> Bifunctor p
second :: (b -> c) -> Biap bi a b -> Biap bi a c
$csecond :: forall (bi :: * -> * -> *) b c a.
Bifunctor bi =>
(b -> c) -> Biap bi a b -> Biap bi a c
first :: (a -> b) -> Biap bi a c -> Biap bi b c
$cfirst :: forall (bi :: * -> * -> *) a b c.
Bifunctor bi =>
(a -> b) -> Biap bi a c -> Biap bi b c
bimap :: (a -> b) -> (c -> d) -> Biap bi a c -> Biap bi b d
$cbimap :: forall (bi :: * -> * -> *) a b c d.
Bifunctor bi =>
(a -> b) -> (c -> d) -> Biap bi a c -> Biap bi b d
Bifunctor
          , Bifunctor (Biap bi)
a -> b -> Biap bi a b
Bifunctor (Biap bi)
-> (forall a b. a -> b -> Biap bi a b)
-> (forall a b c d.
    Biap bi (a -> b) (c -> d) -> Biap bi a c -> Biap bi b d)
-> (forall a b c d e f.
    (a -> b -> c)
    -> (d -> e -> f) -> Biap bi a d -> Biap bi b e -> Biap bi c f)
-> (forall a b c d. Biap bi a b -> Biap bi c d -> Biap bi c d)
-> (forall a b c d. Biap bi a b -> Biap bi c d -> Biap bi a b)
-> Biapplicative (Biap bi)
Biap bi a b -> Biap bi c d -> Biap bi c d
Biap bi a b -> Biap bi c d -> Biap bi a b
Biap bi (a -> b) (c -> d) -> Biap bi a c -> Biap bi b d
(a -> b -> c)
-> (d -> e -> f) -> Biap bi a d -> Biap bi b e -> Biap bi c f
forall a b. a -> b -> Biap bi a b
forall a b c d. Biap bi a b -> Biap bi c d -> Biap bi a b
forall a b c d. Biap bi a b -> Biap bi c d -> Biap bi c d
forall a b c d.
Biap bi (a -> b) (c -> d) -> Biap bi a c -> Biap bi b d
forall a b c d e f.
(a -> b -> c)
-> (d -> e -> f) -> Biap bi a d -> Biap bi b e -> Biap bi c f
forall (p :: * -> * -> *).
Bifunctor p
-> (forall a b. a -> b -> p a b)
-> (forall a b c d. p (a -> b) (c -> d) -> p a c -> p b d)
-> (forall a b c d e f.
    (a -> b -> c) -> (d -> e -> f) -> p a d -> p b e -> p c f)
-> (forall a b c d. p a b -> p c d -> p c d)
-> (forall a b c d. p a b -> p c d -> p a b)
-> Biapplicative p
forall (bi :: * -> * -> *). Biapplicative bi => Bifunctor (Biap bi)
forall (bi :: * -> * -> *) a b.
Biapplicative bi =>
a -> b -> Biap bi a b
forall (bi :: * -> * -> *) a b c d.
Biapplicative bi =>
Biap bi a b -> Biap bi c d -> Biap bi a b
forall (bi :: * -> * -> *) a b c d.
Biapplicative bi =>
Biap bi a b -> Biap bi c d -> Biap bi c d
forall (bi :: * -> * -> *) a b c d.
Biapplicative bi =>
Biap bi (a -> b) (c -> d) -> Biap bi a c -> Biap bi b d
forall (bi :: * -> * -> *) a b c d e f.
Biapplicative bi =>
(a -> b -> c)
-> (d -> e -> f) -> Biap bi a d -> Biap bi b e -> Biap bi c f
<<* :: Biap bi a b -> Biap bi c d -> Biap bi a b
$c<<* :: forall (bi :: * -> * -> *) a b c d.
Biapplicative bi =>
Biap bi a b -> Biap bi c d -> Biap bi a b
*>> :: Biap bi a b -> Biap bi c d -> Biap bi c d
$c*>> :: forall (bi :: * -> * -> *) a b c d.
Biapplicative bi =>
Biap bi a b -> Biap bi c d -> Biap bi c d
biliftA2 :: (a -> b -> c)
-> (d -> e -> f) -> Biap bi a d -> Biap bi b e -> Biap bi c f
$cbiliftA2 :: forall (bi :: * -> * -> *) a b c d e f.
Biapplicative bi =>
(a -> b -> c)
-> (d -> e -> f) -> Biap bi a d -> Biap bi b e -> Biap bi c f
<<*>> :: Biap bi (a -> b) (c -> d) -> Biap bi a c -> Biap bi b d
$c<<*>> :: forall (bi :: * -> * -> *) a b c d.
Biapplicative bi =>
Biap bi (a -> b) (c -> d) -> Biap bi a c -> Biap bi b d
bipure :: a -> b -> Biap bi a b
$cbipure :: forall (bi :: * -> * -> *) a b.
Biapplicative bi =>
a -> b -> Biap bi a b
$cp1Biapplicative :: forall (bi :: * -> * -> *). Biapplicative bi => Bifunctor (Biap bi)
Biapplicative
          , Biap bi m m -> m
(a -> m) -> (b -> m) -> Biap bi a b -> m
(a -> c -> c) -> (b -> c -> c) -> c -> Biap bi a b -> c
(c -> a -> c) -> (c -> b -> c) -> c -> Biap bi a b -> c
(forall m. Monoid m => Biap bi m m -> m)
-> (forall m a b.
    Monoid m =>
    (a -> m) -> (b -> m) -> Biap bi a b -> m)
-> (forall a c b.
    (a -> c -> c) -> (b -> c -> c) -> c -> Biap bi a b -> c)
-> (forall c a b.
    (c -> a -> c) -> (c -> b -> c) -> c -> Biap bi a b -> c)
-> Bifoldable (Biap bi)
forall m. Monoid m => Biap bi m m -> m
forall m a b. Monoid m => (a -> m) -> (b -> m) -> Biap bi a b -> m
forall c a b.
(c -> a -> c) -> (c -> b -> c) -> c -> Biap bi a b -> c
forall a c b.
(a -> c -> c) -> (b -> c -> c) -> c -> Biap bi a b -> c
forall (bi :: * -> * -> *) m.
(Bifoldable bi, Monoid m) =>
Biap bi m m -> m
forall (bi :: * -> * -> *) m a b.
(Bifoldable bi, Monoid m) =>
(a -> m) -> (b -> m) -> Biap bi a b -> m
forall (bi :: * -> * -> *) c a b.
Bifoldable bi =>
(c -> a -> c) -> (c -> b -> c) -> c -> Biap bi a b -> c
forall (bi :: * -> * -> *) a c b.
Bifoldable bi =>
(a -> c -> c) -> (b -> c -> c) -> c -> Biap bi a b -> c
forall (p :: * -> * -> *).
(forall m. Monoid m => p m m -> m)
-> (forall m a b. Monoid m => (a -> m) -> (b -> m) -> p a b -> m)
-> (forall a c b.
    (a -> c -> c) -> (b -> c -> c) -> c -> p a b -> c)
-> (forall c a b.
    (c -> a -> c) -> (c -> b -> c) -> c -> p a b -> c)
-> Bifoldable p
bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> Biap bi a b -> c
$cbifoldl :: forall (bi :: * -> * -> *) c a b.
Bifoldable bi =>
(c -> a -> c) -> (c -> b -> c) -> c -> Biap bi a b -> c
bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> Biap bi a b -> c
$cbifoldr :: forall (bi :: * -> * -> *) a c b.
Bifoldable bi =>
(a -> c -> c) -> (b -> c -> c) -> c -> Biap bi a b -> c
bifoldMap :: (a -> m) -> (b -> m) -> Biap bi a b -> m
$cbifoldMap :: forall (bi :: * -> * -> *) m a b.
(Bifoldable bi, Monoid m) =>
(a -> m) -> (b -> m) -> Biap bi a b -> m
bifold :: Biap bi m m -> m
$cbifold :: forall (bi :: * -> * -> *) m.
(Bifoldable bi, Monoid m) =>
Biap bi m m -> m
Bifoldable
#if LIFTED_FUNCTOR_CLASSES
          , (a -> b -> Bool)
-> (c -> d -> Bool) -> Biap bi a c -> Biap bi b d -> Bool
(forall a b c d.
 (a -> b -> Bool)
 -> (c -> d -> Bool) -> Biap bi a c -> Biap bi b d -> Bool)
-> Eq2 (Biap bi)
forall a b c d.
(a -> b -> Bool)
-> (c -> d -> Bool) -> Biap bi a c -> Biap bi b d -> Bool
forall (bi :: * -> * -> *) a b c d.
Eq2 bi =>
(a -> b -> Bool)
-> (c -> d -> Bool) -> Biap bi a c -> Biap bi b d -> Bool
forall (f :: * -> * -> *).
(forall a b c d.
 (a -> b -> Bool) -> (c -> d -> Bool) -> f a c -> f b d -> Bool)
-> Eq2 f
liftEq2 :: (a -> b -> Bool)
-> (c -> d -> Bool) -> Biap bi a c -> Biap bi b d -> Bool
$cliftEq2 :: forall (bi :: * -> * -> *) a b c d.
Eq2 bi =>
(a -> b -> Bool)
-> (c -> d -> Bool) -> Biap bi a c -> Biap bi b d -> Bool
Eq2
          , Eq2 (Biap bi)
Eq2 (Biap bi)
-> (forall a b c d.
    (a -> b -> Ordering)
    -> (c -> d -> Ordering) -> Biap bi a c -> Biap bi b d -> Ordering)
-> Ord2 (Biap bi)
(a -> b -> Ordering)
-> (c -> d -> Ordering) -> Biap bi a c -> Biap bi b d -> Ordering
forall a b c d.
(a -> b -> Ordering)
-> (c -> d -> Ordering) -> Biap bi a c -> Biap bi b d -> Ordering
forall (f :: * -> * -> *).
Eq2 f
-> (forall a b c d.
    (a -> b -> Ordering)
    -> (c -> d -> Ordering) -> f a c -> f b d -> Ordering)
-> Ord2 f
forall (bi :: * -> * -> *). Ord2 bi => Eq2 (Biap bi)
forall (bi :: * -> * -> *) a b c d.
Ord2 bi =>
(a -> b -> Ordering)
-> (c -> d -> Ordering) -> Biap bi a c -> Biap bi b d -> Ordering
liftCompare2 :: (a -> b -> Ordering)
-> (c -> d -> Ordering) -> Biap bi a c -> Biap bi b d -> Ordering
$cliftCompare2 :: forall (bi :: * -> * -> *) a b c d.
Ord2 bi =>
(a -> b -> Ordering)
-> (c -> d -> Ordering) -> Biap bi a c -> Biap bi b d -> Ordering
$cp1Ord2 :: forall (bi :: * -> * -> *). Ord2 bi => Eq2 (Biap bi)
Ord2
#endif
          )

instance Bitraversable bi => Bitraversable (Biap bi) where
 bitraverse :: (a -> f c) -> (b -> f d) -> Biap bi a b -> f (Biap bi c d)
bitraverse a -> f c
f b -> f d
g (Biap bi a b
as) = bi c d -> Biap bi c d
forall (bi :: * -> * -> *) a b. bi a b -> Biap bi a b
Biap (bi c d -> Biap bi c d) -> f (bi c d) -> f (Biap bi c d)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (a -> f c) -> (b -> f d) -> bi a b -> f (bi c d)
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 bi a b
as

instance (Biapplicative bi, S.Semigroup a, S.Semigroup b) => S.Semigroup (Biap bi a b) where
  <> :: Biap bi a b -> Biap bi a b -> Biap bi a b
(<>) = (a -> a -> a)
-> (b -> b -> b) -> Biap bi a b -> Biap bi a b -> Biap bi a b
forall (p :: * -> * -> *) a b c d e f.
Biapplicative p =>
(a -> b -> c) -> (d -> e -> f) -> p a d -> p b e -> p c f
biliftA2 a -> a -> a
forall a. Semigroup a => a -> a -> a
(S.<>) b -> b -> b
forall a. Semigroup a => a -> a -> a
(S.<>)

instance (Biapplicative bi, Monoid a, Monoid b) => Monoid (Biap bi a b) where
  mempty :: Biap bi a b
mempty = a -> b -> Biap bi a b
forall (p :: * -> * -> *) a b. Biapplicative p => a -> b -> p a b
bipure a
forall a. Monoid a => a
mempty b
forall a. Monoid a => a
mempty
#if !(MIN_VERSION_base(4,11,0))
  mappend = biliftA2 mappend mappend
#endif

instance (Biapplicative bi, Bounded a, Bounded b) => Bounded (Biap bi a b) where
  minBound :: Biap bi a b
minBound = a -> b -> Biap bi a b
forall (p :: * -> * -> *) a b. Biapplicative p => a -> b -> p a b
bipure a
forall a. Bounded a => a
minBound b
forall a. Bounded a => a
minBound
  maxBound :: Biap bi a b
maxBound = a -> b -> Biap bi a b
forall (p :: * -> * -> *) a b. Biapplicative p => a -> b -> p a b
bipure a
forall a. Bounded a => a
maxBound b
forall a. Bounded a => a
maxBound

instance ( Biapplicative bi, Num a, Num b
#if !(MIN_VERSION_base(4,5,0))
           -- Old versions of Num have Eq and Show as superclasses. Sigh.
         , Eq (bi a b), Show (bi a b)
#endif
         ) => Num (Biap bi a b) where
  + :: Biap bi a b -> Biap bi a b -> Biap bi a b
(+) = (a -> a -> a)
-> (b -> b -> b) -> Biap bi a b -> Biap bi a b -> Biap bi a b
forall (p :: * -> * -> *) a b c d e f.
Biapplicative p =>
(a -> b -> c) -> (d -> e -> f) -> p a d -> p b e -> p c f
biliftA2 a -> a -> a
forall a. Num a => a -> a -> a
(+) b -> b -> b
forall a. Num a => a -> a -> a
(+)
  * :: Biap bi a b -> Biap bi a b -> Biap bi a b
(*) = (a -> a -> a)
-> (b -> b -> b) -> Biap bi a b -> Biap bi a b -> Biap bi a b
forall (p :: * -> * -> *) a b c d e f.
Biapplicative p =>
(a -> b -> c) -> (d -> e -> f) -> p a d -> p b e -> p c f
biliftA2 a -> a -> a
forall a. Num a => a -> a -> a
(*) b -> b -> b
forall a. Num a => a -> a -> a
(*)

  negate :: Biap bi a b -> Biap bi a b
negate = (a -> a) -> (b -> b) -> Biap bi a b -> Biap bi a b
forall (p :: * -> * -> *) a b c d.
Bifunctor p =>
(a -> b) -> (c -> d) -> p a c -> p b d
bimap a -> a
forall a. Num a => a -> a
negate b -> b
forall a. Num a => a -> a
negate
  abs :: Biap bi a b -> Biap bi a b
abs    = (a -> a) -> (b -> b) -> Biap bi a b -> Biap bi a b
forall (p :: * -> * -> *) a b c d.
Bifunctor p =>
(a -> b) -> (c -> d) -> p a c -> p b d
bimap a -> a
forall a. Num a => a -> a
abs    b -> b
forall a. Num a => a -> a
abs
  signum :: Biap bi a b -> Biap bi a b
signum = (a -> a) -> (b -> b) -> Biap bi a b -> Biap bi a b
forall (p :: * -> * -> *) a b c d.
Bifunctor p =>
(a -> b) -> (c -> d) -> p a c -> p b d
bimap a -> a
forall a. Num a => a -> a
signum b -> b
forall a. Num a => a -> a
signum

  fromInteger :: Integer -> Biap bi a b
fromInteger Integer
n = a -> b -> Biap bi a b
forall (p :: * -> * -> *) a b. Biapplicative p => a -> b -> p a b
bipure (Integer -> a
forall a. Num a => Integer -> a
fromInteger Integer
n) (Integer -> b
forall a. Num a => Integer -> a
fromInteger Integer
n)

#if __GLASGOW_HASKELL__ >= 702 && __GLASGOW_HASKELL__ < 706
data BiapMetaData
data BiapMetaCons
data BiapMetaSel

instance Datatype BiapMetaData where
    datatypeName = const "Biap"
    moduleName = const "Data.Bifunctor.Wrapped"

instance Constructor BiapMetaCons where
    conName = const "Biap"
    conIsRecord = const True

instance Selector BiapMetaSel where
    selName = const "getBiap"

instance Generic1 (Biap p a) where
    type Rep1 (Biap p a) = D1 BiapMetaData
        (C1 BiapMetaCons
            (S1 BiapMetaSel (Rec1 (p a))))
    from1 = M1 . M1 . M1 . Rec1 . getBiap
    to1 = Biap . unRec1 . unM1 . unM1 . unM1
#endif