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) # | |
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) # | |
Bifunctor bi => Bifunctor (Biap bi) # | |
Eq2 bi => Eq2 (Biap bi) # | |
Ord2 bi => Ord2 (Biap bi) # | |
Defined in Data.Bifunctor.Biap | |
Biapplicative bi => Biapplicative (Biap bi) # | |
Defined in Data.Bifunctor.Biap | |
Generic1 (Biap bi a :: Type -> Type) # | |
Monad (bi a) => Monad (Biap bi a) # | |
Functor (bi a) => Functor (Biap bi a) # | |
MonadFail (bi a) => MonadFail (Biap bi a) # | |
Defined in Data.Bifunctor.Biap | |
Applicative (bi a) => Applicative (Biap bi a) # | |
Foldable (bi a) => Foldable (Biap bi a) # | |
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) # | |
Defined in Data.Bifunctor.Biap | |
Eq1 (bi a) => Eq1 (Biap bi a) # | |
Ord1 (bi a) => Ord1 (Biap bi a) # | |
Defined in Data.Bifunctor.Biap | |
Alternative (bi a) => Alternative (Biap bi a) # | |
MonadPlus (bi a) => MonadPlus (Biap bi a) # | |
(Biapplicative bi, Bounded a, Bounded b) => Bounded (Biap bi a b) # | |
Enum (bi a b) => Enum (Biap bi a b) # | |
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) # | |
(Biapplicative bi, Num a, Num b) => Num (Biap bi a b) # | |
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) # | |
Defined in Data.Bifunctor.Biap | |
Read (bi a b) => Read (Biap bi a b) # | |
Show (bi a b) => Show (Biap bi a b) # | |
Generic (Biap bi a b) # | |
(Biapplicative bi, Semigroup a, Semigroup b) => Semigroup (Biap bi a b) # | |
(Biapplicative bi, Monoid a, Monoid b) => Monoid (Biap bi a b) # | |
type Rep1 (Biap bi a :: Type -> Type) # | |
Defined in Data.Bifunctor.Biap | |
type Rep (Biap bi a b) # | |
Defined in Data.Bifunctor.Biap |