bifunctors-5.5.14: Bifunctors
Copyright (C) 2008-2016 Edward Kmett
License BSD-style (see the file LICENSE)
Maintainer Edward Kmett <ekmett@gmail.com>
Stability provisional
Portability portable
Safe Haskell Trustworthy
Language Haskell2010

Data.Bifunctor.Biap

Description

Synopsis

Documentation

newtype Biap bi 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
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) Source #

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

Defined in Data.Bifunctor.Biap

Methods

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

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

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

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

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

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

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

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

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

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 #

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

Defined in Data.Bifunctor.Biap

Associated Types

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

Methods

from1 :: forall (a0 :: k). Biap bi a a0 -> Rep1 ( Biap bi a) a0 Source #

to1 :: forall (a0 :: k). Rep1 ( Biap bi a) a0 -> Biap bi a a0 Source #

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

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

return :: a0 -> Biap bi a a0 Source #

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

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

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

Defined in Data.Bifunctor.Biap

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

Defined in Data.Bifunctor.Biap

Methods

pure :: a0 -> Biap bi a a0 Source #

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

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

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

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

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

Defined in Data.Bifunctor.Biap

Methods

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

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

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

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

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

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

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

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

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

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

null :: Biap bi a a0 -> Bool Source #

length :: Biap bi a a0 -> Int Source #

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

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

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

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

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

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) Source #

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

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

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

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

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

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

Defined in Data.Bifunctor.Biap

Methods

empty :: Biap bi a a0 Source #

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

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

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

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

Defined in Data.Bifunctor.Biap

Methods

mzero :: Biap bi a a0 Source #

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

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

Defined in Data.Bifunctor.Biap

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

Defined in Data.Bifunctor.Biap

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

Defined in Data.Bifunctor.Biap

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

Defined in Data.Bifunctor.Biap

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

Defined in Data.Bifunctor.Biap

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

Defined in Data.Bifunctor.Biap

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

Defined in Data.Bifunctor.Biap

Generic ( Biap bi a b) Source #
Instance details

Defined in Data.Bifunctor.Biap

Associated Types

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

Methods

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

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

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

Defined in Data.Bifunctor.Biap

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

Defined in Data.Bifunctor.Biap

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.5.14-4o2vxpA6iYN8K0rfLgtyzm" ' 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.5.14-4o2vxpA6iYN8K0rfLgtyzm" ' True ) ( C1 (' MetaCons "Biap" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "getBiap") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 (bi a b))))