numhask-0.3.0.0: numeric classes

Safe HaskellNone
LanguageHaskell2010

NumHask.Data.Pair

Description

A Pair is *the* classical higher-kinded number but there is no canon.

Synopsis

Documentation

newtype Pair a Source #

A pair of a's, implemented as a tuple, but api represented as a Pair of a's.

>>> fmap (+1) (Pair 1 2)
Pair 2 3
>>> pure one :: Pair Int
Pair 1 1
>>> (*) <$> Pair 1 2 <*> pure 2
Pair 2 4
>>> foldr (++) [] (Pair [1,2] [3])
[1,2,3]
>>> Pair "a" "pair" `mappend` pure " " `mappend` Pair "string" "mappended"
Pair "a string" "pair mappended"

As a Ring and Field class

>>> Pair 0 1 + zero
Pair 0 1
>>> Pair 0 1 + Pair 2 3
Pair 2 4
>>> Pair 1 1 - one
Pair 0 0
>>> Pair 0 1 * one
Pair 0 1
>>> Pair 0.0 1.0 / one
Pair 0.0 1.0
>>> Pair 11 12 `mod` (pure 6)
Pair 5 0

As an action

>>> Pair 1 2 .+ 3
Pair 4 5

Constructors

Pair' (a, a) 
Instances
Monad Pair Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

(>>=) :: Pair a -> (a -> Pair b) -> Pair b #

(>>) :: Pair a -> Pair b -> Pair b #

return :: a -> Pair a #

fail :: String -> Pair a #

Functor Pair Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

fmap :: (a -> b) -> Pair a -> Pair b #

(<$) :: a -> Pair b -> Pair a #

Applicative Pair Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

pure :: a -> Pair a #

(<*>) :: Pair (a -> b) -> Pair a -> Pair b #

liftA2 :: (a -> b -> c) -> Pair a -> Pair b -> Pair c #

(*>) :: Pair a -> Pair b -> Pair b #

(<*) :: Pair a -> Pair b -> Pair a #

Foldable Pair Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

fold :: Monoid m => Pair m -> m #

foldMap :: Monoid m => (a -> m) -> Pair a -> m #

foldr :: (a -> b -> b) -> b -> Pair a -> b #

foldr' :: (a -> b -> b) -> b -> Pair a -> b #

foldl :: (b -> a -> b) -> b -> Pair a -> b #

foldl' :: (b -> a -> b) -> b -> Pair a -> b #

foldr1 :: (a -> a -> a) -> Pair a -> a #

foldl1 :: (a -> a -> a) -> Pair a -> a #

toList :: Pair a -> [a] #

null :: Pair a -> Bool #

length :: Pair a -> Int #

elem :: Eq a => a -> Pair a -> Bool #

maximum :: Ord a => Pair a -> a #

minimum :: Ord a => Pair a -> a #

sum :: Num a => Pair a -> a #

product :: Num a => Pair a -> a #

Traversable Pair Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

traverse :: Applicative f => (a -> f b) -> Pair a -> f (Pair b) #

sequenceA :: Applicative f => Pair (f a) -> f (Pair a) #

mapM :: Monad m => (a -> m b) -> Pair a -> m (Pair b) #

sequence :: Monad m => Pair (m a) -> m (Pair a) #

Eq1 Pair Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

liftEq :: (a -> b -> Bool) -> Pair a -> Pair b -> Bool #

Show1 Pair Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Pair a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Pair a] -> ShowS #

Bounded a => Bounded (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

minBound :: Pair a #

maxBound :: Pair a #

Eq a => Eq (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

(==) :: Pair a -> Pair a -> Bool #

(/=) :: Pair a -> Pair a -> Bool #

Show a => Show (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

showsPrec :: Int -> Pair a -> ShowS #

show :: Pair a -> String #

showList :: [Pair a] -> ShowS #

Generic (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Associated Types

type Rep (Pair a) :: Type -> Type #

Methods

from :: Pair a -> Rep (Pair a) x #

to :: Rep (Pair a) x -> Pair a #

Semigroup a => Semigroup (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

(<>) :: Pair a -> Pair a -> Pair a #

sconcat :: NonEmpty (Pair a) -> Pair a #

stimes :: Integral b => b -> Pair a -> Pair a #

(Semigroup a, Monoid a) => Monoid (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

mempty :: Pair a #

mappend :: Pair a -> Pair a -> Pair a #

mconcat :: [Pair a] -> Pair a #

Subtractive a => Subtractive (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

negate :: Pair a -> Pair a Source #

(-) :: Pair a -> Pair a -> Pair a Source #

Additive a => Additive (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

(+) :: Pair a -> Pair a -> Pair a Source #

zero :: Pair a Source #

Divisive a => Divisive (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

recip :: Pair a -> Pair a Source #

(/) :: Pair a -> Pair a -> Pair a Source #

Multiplicative a => Multiplicative (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

(*) :: Pair a -> Pair a -> Pair a Source #

one :: Pair a Source #

Divisive a => DivisiveAction (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

(./) :: Pair a -> Actor (Pair a) -> Pair a Source #

(/.) :: Actor (Pair a) -> Pair a -> Pair a Source #

Multiplicative a => MultiplicativeAction (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

(.*) :: Pair a -> Actor (Pair a) -> Pair a Source #

(*.) :: Actor (Pair a) -> Pair a -> Pair a Source #

Subtractive a => SubtractiveAction (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

(.-) :: Pair a -> Actor (Pair a) -> Pair a Source #

(-.) :: Actor (Pair a) -> Pair a -> Pair a Source #

Additive a => AdditiveAction (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

(.+) :: Pair a -> Actor (Pair a) -> Pair a Source #

(+.) :: Actor (Pair a) -> Pair a -> Pair a Source #

IntegralDomain a => IntegralDomain (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Distributive a => Distributive (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

FromInteger a => FromInteger (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Integral a => Integral (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

div :: Pair a -> Pair a -> Pair a Source #

mod :: Pair a -> Pair a -> Pair a Source #

divMod :: Pair a -> Pair a -> (Pair a, Pair a) Source #

quot :: Pair a -> Pair a -> Pair a Source #

rem :: Pair a -> Pair a -> Pair a Source #

quotRem :: Pair a -> Pair a -> (Pair a, Pair a) Source #

LowerBoundedField a => LowerBoundedField (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

negInfinity :: Pair a Source #

UpperBoundedField a => UpperBoundedField (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

ExpField a => ExpField (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

exp :: Pair a -> Pair a Source #

log :: Pair a -> Pair a Source #

logBase :: Pair a -> Pair a -> Pair a Source #

(**) :: Pair a -> Pair a -> Pair a Source #

sqrt :: Pair a -> Pair a Source #

Field a => Field (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

BoundedMeetSemiLattice a => BoundedMeetSemiLattice (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

top :: Pair a Source #

BoundedJoinSemiLattice a => BoundedJoinSemiLattice (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

bottom :: Pair a Source #

MeetSemiLattice a => MeetSemiLattice (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

(/\) :: Pair a -> Pair a -> Pair a Source #

JoinSemiLattice a => JoinSemiLattice (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

(\/) :: Pair a -> Pair a -> Pair a Source #

(Subtractive a, Epsilon a) => Epsilon (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Signed a => Signed (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

sign :: Pair a -> Pair a Source #

abs :: Pair a -> Pair a Source #

FromRatio a => FromRatio (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

(ExpField a, Subtractive a, Normed a a) => Metric (Pair a) a Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

distanceL1 :: Pair a -> Pair a -> a Source #

distanceL2 :: Pair a -> Pair a -> a Source #

(ExpField a, Normed a a) => Normed (Pair a) a Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

normL1 :: Pair a -> a Source #

normL2 :: Pair a -> a Source #

(Subtractive a, Normed a a) => Metric (Pair a) (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

distanceL1 :: Pair a -> Pair a -> Pair a Source #

distanceL2 :: Pair a -> Pair a -> Pair a Source #

Normed a a => Normed (Pair a) (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

normL1 :: Pair a -> Pair a Source #

normL2 :: Pair a -> Pair a Source #

type Rep (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

type Rep (Pair a) = D1 (MetaData "Pair" "NumHask.Data.Pair" "numhask-0.3.0.0-6WRgeQbTP4wKSUIUfjamJd" True) (C1 (MetaCons "Pair'" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (a, a))))
type Actor (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

type Actor (Pair a) = a

pattern Pair :: a -> a -> Pair a Source #

the preferred pattern