uniform-pair-0.1.15: Uniform pairs with class instances

Copyright(c) 2013 Tabula Inc.
Maintainerconal@conal.net
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell98

Data.UniformPair

Description

Uniform pairs. Because these pairs memoize functions (from Bool)--i.e., they're representable functors--these instances provided are fully determined by the corresponding instances for functions, thanks to the type class morphism principle.

Synopsis

Documentation

data Pair a Source #

Uniform pairs

Constructors

a :# a infix 1 
Instances
Monad Pair Source # 
Instance details

Defined in Data.UniformPair

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 Data.UniformPair

Methods

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

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

Applicative Pair Source # 
Instance details

Defined in Data.UniformPair

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 Data.UniformPair

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 Data.UniformPair

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

Distributive Pair Source # 
Instance details

Defined in Data.UniformPair

Methods

distribute :: Functor f => f (Pair a) -> Pair (f a) #

collect :: Functor f => (a -> Pair b) -> f a -> Pair (f b) #

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

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

Representable Pair Source # 
Instance details

Defined in Data.UniformPair

Associated Types

type Rep Pair :: * #

Methods

tabulate :: (Rep Pair -> a) -> Pair a #

index :: Pair a -> Rep Pair -> a #

Eq1 Pair Source # 
Instance details

Defined in Data.UniformPair

Methods

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

Ord1 Pair Source # 
Instance details

Defined in Data.UniformPair

Methods

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

Show1 Pair Source # 
Instance details

Defined in Data.UniformPair

Methods

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

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

Eq1 Pair Source # 
Instance details

Defined in Data.UniformPair

Methods

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

Ord1 Pair Source # 
Instance details

Defined in Data.UniformPair

Methods

compare1 :: Ord a => Pair a -> Pair a -> Ordering #

Show1 Pair Source # 
Instance details

Defined in Data.UniformPair

Methods

showsPrec1 :: Show a => Int -> Pair a -> ShowS #

showList1 :: Show a => [Pair a] -> ShowS #

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

Defined in Data.UniformPair

Methods

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

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

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

Defined in Data.UniformPair

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Pair a -> c (Pair a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Pair a) #

toConstr :: Pair a -> Constr #

dataTypeOf :: Pair a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Pair a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Pair a)) #

gmapT :: (forall b. Data b => b -> b) -> Pair a -> Pair a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Pair a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Pair a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Pair a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Pair a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Pair a -> m (Pair a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Pair a -> m (Pair a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Pair a -> m (Pair a) #

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

Defined in Data.UniformPair

Methods

compare :: Pair a -> Pair a -> Ordering #

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

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

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

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

max :: Pair a -> Pair a -> Pair a #

min :: Pair a -> Pair a -> Pair a #

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

Defined in Data.UniformPair

Methods

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

show :: Pair a -> String #

showList :: [Pair a] -> ShowS #

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

Defined in Data.UniformPair

Methods

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

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

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

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

Defined in Data.UniformPair

Methods

mempty :: Pair a #

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

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

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

Defined in Data.UniformPair

Methods

rnf :: Pair a -> () #

type Rep Pair Source # 
Instance details

Defined in Data.UniformPair

type Rep Pair = Bool

fstP :: Pair a -> a Source #

sndP :: Pair a -> a Source #

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

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

getP :: Bool -> Pair a -> a Source #

Extract an element, indexing by False for the first element and True for the second.

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

Update a component, indexing by False for the first element and True for the second.

swapP :: Pair a -> Pair a Source #

Swap the elements of a Pair

compareSwap :: Ord a => Pair a -> Pair a Source #