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 |
Documentation
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
Instances
Bitraversable bi => Bitraversable ( Biap bi) Source # | |
Defined in Data.Bifunctor.Biap 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 # | |
Defined in Data.Bifunctor.Biap |
|
Bifunctor bi => Bifunctor ( Biap bi) Source # | |
Eq2 bi => Eq2 ( Biap bi) Source # | |
Ord2 bi => Ord2 ( Biap bi) Source # | |
Defined in Data.Bifunctor.Biap |
|
Biapplicative bi => Biapplicative ( Biap bi) Source # | |
Defined in Data.Bifunctor.Biap |
|
Generic1 ( Biap bi a :: Type -> Type ) Source # | |
Monad (bi a) => Monad ( Biap bi a) Source # | |
Functor (bi a) => Functor ( Biap bi a) Source # | |
MonadFail (bi a) => MonadFail ( Biap bi a) Source # | |
Applicative (bi a) => Applicative ( Biap bi a) Source # | |
Defined in Data.Bifunctor.Biap 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 # | |
Defined in Data.Bifunctor.Biap 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 # |
|
Traversable (bi a) => Traversable ( Biap bi a) Source # | |
Defined in Data.Bifunctor.Biap 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 # | |
Ord1 (bi a) => Ord1 ( Biap bi a) Source # | |
Defined in Data.Bifunctor.Biap |
|
Alternative (bi a) => Alternative ( Biap bi a) Source # | |
MonadPlus (bi a) => MonadPlus ( Biap bi a) Source # | |
( Biapplicative bi, Bounded a, Bounded b) => Bounded ( Biap bi a b) Source # | |
Enum (bi a b) => Enum ( Biap bi a b) Source # | |
Defined in Data.Bifunctor.Biap succ :: Biap bi a b -> Biap bi a b Source # pred :: Biap bi a b -> Biap bi a b Source # toEnum :: Int -> Biap bi a b Source # fromEnum :: Biap bi a b -> Int Source # enumFrom :: Biap bi a b -> [ Biap bi a b] Source # enumFromThen :: Biap bi a b -> Biap bi a b -> [ Biap bi a b] Source # enumFromTo :: Biap bi a b -> Biap bi a b -> [ Biap bi a b] Source # enumFromThenTo :: Biap bi a b -> Biap bi a b -> Biap bi a b -> [ Biap bi a b] Source # |
|
Eq (bi a b) => Eq ( Biap bi a b) Source # | |
( Biapplicative bi, Num a, Num b) => Num ( Biap bi a b) Source # | |
Defined in Data.Bifunctor.Biap (+) :: Biap bi a b -> Biap bi a b -> Biap bi a b Source # (-) :: Biap bi a b -> Biap bi a b -> Biap bi a b Source # (*) :: Biap bi a b -> Biap bi a b -> Biap bi a b Source # negate :: Biap bi a b -> Biap bi a b Source # abs :: Biap bi a b -> Biap bi a b Source # signum :: Biap bi a b -> Biap bi a b Source # fromInteger :: Integer -> Biap bi a b Source # |
|
Ord (bi a b) => Ord ( Biap bi a b) Source # | |
Defined in Data.Bifunctor.Biap compare :: Biap bi a b -> Biap bi a b -> Ordering Source # (<) :: Biap bi a b -> Biap bi a b -> Bool Source # (<=) :: Biap bi a b -> Biap bi a b -> Bool Source # (>) :: Biap bi a b -> Biap bi a b -> Bool Source # (>=) :: Biap bi a b -> Biap bi a b -> Bool Source # |
|
Read (bi a b) => Read ( Biap bi a b) Source # | |
Show (bi a b) => Show ( Biap bi a b) Source # | |
Generic ( Biap bi a b) Source # | |
( Biapplicative bi, Semigroup a, Semigroup b) => Semigroup ( Biap bi a b) Source # | |
( Biapplicative bi, Monoid a, Monoid b) => Monoid ( Biap bi a b) Source # | |
type Rep1 ( Biap bi a :: Type -> Type ) Source # | |
Defined in Data.Bifunctor.Biap |
|
type Rep ( Biap bi a b) Source # | |
Defined in Data.Bifunctor.Biap |