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) # | |
Bifoldable bi => Bifoldable (Biap bi) Source # | |
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 # | |
Defined in Data.Bifunctor.Biap | |
Applicative (bi a) => Applicative (Biap bi a) Source # | |
Foldable (bi a) => Foldable (Biap bi a) Source # | |
Defined in Data.Bifunctor.Biap 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 # | |
Traversable (bi a) => Traversable (Biap bi a) Source # | |
Defined in Data.Bifunctor.Biap | |
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 # 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] # | |
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 # (-) :: 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 # | |
Ord (bi a b) => Ord (Biap bi a b) Source # | |
Defined in Data.Bifunctor.Biap | |
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 |