bifunctors-5.6.2: Bifunctors
Copyright(C) 2008-2016 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityprovisional
Portabilityportable
Safe HaskellTrustworthy
LanguageHaskell2010

Data.Bifunctor.Biap

Description

 
Synopsis

Documentation

newtype Biap (bi :: Type -> Type -> Type) a b Source #

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 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

Constructors

Biap 

Fields

Instances

Instances details
Generic1 (Biap bi a :: Type -> Type) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Associated Types

type Rep1 (Biap bi a :: Type -> Type) 
Instance details

Defined in Data.Bifunctor.Biap

type Rep1 (Biap bi a :: Type -> Type) = D1 ('MetaData "Biap" "Data.Bifunctor.Biap" "bifunctors-5.6.2-EFCED5cRXUbF5ynLhzsEHB" 'True) (C1 ('MetaCons "Biap" 'PrefixI 'True) (S1 ('MetaSel ('Just "getBiap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 (bi a))))

Methods

from1 :: Biap bi a a0 -> Rep1 (Biap bi a) a0 #

to1 :: Rep1 (Biap bi a) a0 -> Biap bi a a0 #

Bifoldable bi => Bifoldable (Biap bi) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Methods

bifold :: Monoid m => Biap bi m m -> m #

bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> Biap bi a b -> m #

bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> Biap bi a b -> c #

bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> Biap bi a b -> c #

Bifunctor bi => Bifunctor (Biap bi) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Methods

bimap :: (a -> b) -> (c -> d) -> Biap bi a c -> Biap bi b d #

first :: (a -> b) -> Biap bi a c -> Biap bi b c #

second :: (b -> c) -> Biap bi a b -> Biap bi a c #

Bitraversable bi => Bitraversable (Biap bi) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Methods

bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> Biap bi a b -> f (Biap bi c d) #

Eq2 bi => Eq2 (Biap bi) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Methods

liftEq2 :: (a -> b -> Bool) -> (c -> d -> Bool) -> Biap bi a c -> Biap bi b d -> Bool #

Ord2 bi => Ord2 (Biap bi) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Methods

liftCompare2 :: (a -> b -> Ordering) -> (c -> d -> Ordering) -> Biap bi a c -> Biap bi b d -> Ordering #

Biapplicative bi => Biapplicative (Biap bi) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Methods

bipure :: a -> b -> Biap bi a b Source #

(<<*>>) :: Biap bi (a -> b) (c -> d) -> Biap bi a c -> Biap bi b d Source #

biliftA2 :: (a -> b -> c) -> (d -> e -> f) -> Biap bi a d -> Biap bi b e -> Biap bi c f Source #

(*>>) :: Biap bi a b -> Biap bi c d -> Biap bi c d Source #

(<<*) :: Biap bi a b -> Biap bi c d -> Biap bi a b Source #

MonadFail (bi a) => MonadFail (Biap bi a) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Methods

fail :: String -> Biap bi a a0 #

Foldable (bi a) => Foldable (Biap bi a) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Methods

fold :: Monoid m => Biap bi a m -> m #

foldMap :: Monoid m => (a0 -> m) -> Biap bi a a0 -> m #

foldMap' :: Monoid m => (a0 -> m) -> Biap bi a a0 -> m #

foldr :: (a0 -> b -> b) -> b -> Biap bi a a0 -> b #

foldr' :: (a0 -> b -> b) -> b -> Biap bi a a0 -> b #

foldl :: (b -> a0 -> b) -> b -> Biap bi a a0 -> b #

foldl' :: (b -> a0 -> b) -> b -> Biap bi a a0 -> b #

foldr1 :: (a0 -> a0 -> a0) -> Biap bi a a0 -> a0 #

foldl1 :: (a0 -> a0 -> a0) -> Biap bi a a0 -> a0 #

toList :: Biap bi a a0 -> [a0] #

null :: Biap bi a a0 -> Bool #

length :: Biap bi a a0 -> Int #

elem :: Eq a0 => a0 -> Biap bi a a0 -> Bool #

maximum :: Ord a0 => Biap bi a a0 -> a0 #

minimum :: Ord a0 => Biap bi a a0 -> a0 #

sum :: Num a0 => Biap bi a a0 -> a0 #

product :: Num a0 => Biap bi a a0 -> a0 #

Eq1 (bi a) => Eq1 (Biap bi a) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Methods

liftEq :: (a0 -> b -> Bool) -> Biap bi a a0 -> Biap bi a b -> Bool #

Ord1 (bi a) => Ord1 (Biap bi a) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Methods

liftCompare :: (a0 -> b -> Ordering) -> Biap bi a a0 -> Biap bi a b -> Ordering #

Traversable (bi a) => Traversable (Biap bi a) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Methods

traverse :: Applicative f => (a0 -> f b) -> Biap bi a a0 -> f (Biap bi a b) #

sequenceA :: Applicative f => Biap bi a (f a0) -> f (Biap bi a a0) #

mapM :: Monad m => (a0 -> m b) -> Biap bi a a0 -> m (Biap bi a b) #

sequence :: Monad m => Biap bi a (m a0) -> m (Biap bi a a0) #

Alternative (bi a) => Alternative (Biap bi a) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Methods

empty :: Biap bi a a0 #

(<|>) :: Biap bi a a0 -> Biap bi a a0 -> Biap bi a a0 #

some :: Biap bi a a0 -> Biap bi a [a0] #

many :: Biap bi a a0 -> Biap bi a [a0] #

Applicative (bi a) => Applicative (Biap bi a) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Methods

pure :: a0 -> Biap bi a a0 #

(<*>) :: Biap bi a (a0 -> b) -> Biap bi a a0 -> Biap bi a b #

liftA2 :: (a0 -> b -> c) -> Biap bi a a0 -> Biap bi a b -> Biap bi a c #

(*>) :: Biap bi a a0 -> Biap bi a b -> Biap bi a b #

(<*) :: Biap bi a a0 -> Biap bi a b -> Biap bi a a0 #

Functor (bi a) => Functor (Biap bi a) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Methods

fmap :: (a0 -> b) -> Biap bi a a0 -> Biap bi a b #

(<$) :: a0 -> Biap bi a b -> Biap bi a a0 #

Monad (bi a) => Monad (Biap bi a) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Methods

(>>=) :: Biap bi a a0 -> (a0 -> Biap bi a b) -> Biap bi a b #

(>>) :: Biap bi a a0 -> Biap bi a b -> Biap bi a b #

return :: a0 -> Biap bi a a0 #

MonadPlus (bi a) => MonadPlus (Biap bi a) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Methods

mzero :: Biap bi a a0 #

mplus :: Biap bi a a0 -> Biap bi a a0 -> Biap bi a a0 #

(Biapplicative bi, Monoid a, Monoid b) => Monoid (Biap bi a b) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Methods

mempty :: Biap bi a b #

mappend :: Biap bi a b -> Biap bi a b -> Biap bi a b #

mconcat :: [Biap bi a b] -> Biap bi a b #

(Biapplicative bi, Semigroup a, Semigroup b) => Semigroup (Biap bi a b) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Methods

(<>) :: Biap bi a b -> Biap bi a b -> Biap bi a b #

sconcat :: NonEmpty (Biap bi a b) -> Biap bi a b #

stimes :: Integral b0 => b0 -> Biap bi a b -> Biap bi a b #

(Biapplicative bi, Bounded a, Bounded b) => Bounded (Biap bi a b) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Methods

minBound :: Biap bi a b #

maxBound :: Biap bi a b #

Enum (bi a b) => Enum (Biap bi a b) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Methods

succ :: Biap bi a b -> Biap bi a b #

pred :: Biap bi a b -> Biap bi a b #

toEnum :: Int -> Biap bi a b #

fromEnum :: Biap bi a b -> Int #

enumFrom :: Biap bi a b -> [Biap bi a b] #

enumFromThen :: 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] #

enumFromThenTo :: Biap bi a b -> Biap bi a b -> Biap bi a b -> [Biap bi a b] #

Generic (Biap bi a b) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Associated Types

type Rep (Biap bi a b) 
Instance details

Defined in Data.Bifunctor.Biap

type Rep (Biap bi a b) = D1 ('MetaData "Biap" "Data.Bifunctor.Biap" "bifunctors-5.6.2-EFCED5cRXUbF5ynLhzsEHB" 'True) (C1 ('MetaCons "Biap" 'PrefixI 'True) (S1 ('MetaSel ('Just "getBiap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (bi a b))))

Methods

from :: Biap bi a b -> Rep (Biap bi a b) x #

to :: Rep (Biap bi a b) x -> Biap bi a b #

(Biapplicative bi, Num a, Num b) => Num (Biap bi a b) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Methods

(+) :: 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 #

negate :: Biap bi a b -> Biap bi a b #

abs :: Biap bi a b -> Biap bi a b #

signum :: Biap bi a b -> Biap bi a b #

fromInteger :: Integer -> Biap bi a b #

Read (bi a b) => Read (Biap bi a b) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Methods

readsPrec :: Int -> ReadS (Biap bi a b) #

readList :: ReadS [Biap bi a b] #

readPrec :: ReadPrec (Biap bi a b) #

readListPrec :: ReadPrec [Biap bi a b] #

Show (bi a b) => Show (Biap bi a b) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Methods

showsPrec :: Int -> Biap bi a b -> ShowS #

show :: Biap bi a b -> String #

showList :: [Biap bi a b] -> ShowS #

Eq (bi a b) => Eq (Biap bi a b) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Methods

(==) :: Biap bi a b -> Biap bi a b -> Bool #

(/=) :: Biap bi a b -> Biap bi a b -> Bool #

Ord (bi a b) => Ord (Biap bi a b) Source # 
Instance details

Defined in Data.Bifunctor.Biap

Methods

compare :: 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 #

max :: 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 #

type Rep1 (Biap bi a :: Type -> Type) Source # 
Instance details

Defined in Data.Bifunctor.Biap

type Rep1 (Biap bi a :: Type -> Type) = D1 ('MetaData "Biap" "Data.Bifunctor.Biap" "bifunctors-5.6.2-EFCED5cRXUbF5ynLhzsEHB" 'True) (C1 ('MetaCons "Biap" 'PrefixI 'True) (S1 ('MetaSel ('Just "getBiap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 (bi a))))
type Rep (Biap bi a b) Source # 
Instance details

Defined in Data.Bifunctor.Biap

type Rep (Biap bi a b) = D1 ('MetaData "Biap" "Data.Bifunctor.Biap" "bifunctors-5.6.2-EFCED5cRXUbF5ynLhzsEHB" 'True) (C1 ('MetaCons "Biap" 'PrefixI 'True) (S1 ('MetaSel ('Just "getBiap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (bi a b))))