strict-base-0.4.0.0: Strict versions of base data types.

Copyright(c) 2017 Daniel Mendler 2006-2007 Roman Leshchinskiy
LicenseBSD-style (see the file LICENSE)
MaintainerDaniel Mendler <mail@daniel-mendler.de>
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Data.Strict.Tuple

Contents

Description

Strict pairs.

Same as regular Haskell pairs, but (x :!: _|_) = (_|_ :!: y) = _|_

Synopsis

Documentation

data Pair a b Source #

The type of strict pairs.

Constructors

!a :!: !b infixl 2 

Instances

Bifunctor Pair Source # 

Methods

bimap :: (a -> b) -> (c -> d) -> Pair a c -> Pair b d #

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

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

Functor (Pair a) Source # 

Methods

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

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

Foldable (Pair a) Source # 

Methods

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

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

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

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

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

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

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

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

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

null :: Pair a a -> Bool #

length :: Pair a a -> Int #

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

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

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

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

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

Traversable (Pair a) Source # 

Methods

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

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

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

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

Generic1 (Pair a) Source # 

Associated Types

type Rep1 (Pair a :: * -> *) :: * -> * #

Methods

from1 :: Pair a a -> Rep1 (Pair a) a #

to1 :: Rep1 (Pair a) a -> Pair a a #

(Bounded b, Bounded a) => Bounded (Pair a b) Source # 

Methods

minBound :: Pair a b #

maxBound :: Pair a b #

(Eq b, Eq a) => Eq (Pair a b) Source # 

Methods

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

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

(Data b, Data a) => Data (Pair a b) Source # 

Methods

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

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

toConstr :: Pair a b -> Constr #

dataTypeOf :: Pair a b -> DataType #

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

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

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

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

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

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

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

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

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

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

(Ord b, Ord a) => Ord (Pair a b) Source # 

Methods

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

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

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

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

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

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

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

(Read b, Read a) => Read (Pair a b) Source # 

Methods

readsPrec :: Int -> ReadS (Pair a b) #

readList :: ReadS [Pair a b] #

readPrec :: ReadPrec (Pair a b) #

readListPrec :: ReadPrec [Pair a b] #

(Show b, Show a) => Show (Pair a b) Source # 

Methods

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

show :: Pair a b -> String #

showList :: [Pair a b] -> ShowS #

(Ix b, Ix a) => Ix (Pair a b) Source # 

Methods

range :: (Pair a b, Pair a b) -> [Pair a b] #

index :: (Pair a b, Pair a b) -> Pair a b -> Int #

unsafeIndex :: (Pair a b, Pair a b) -> Pair a b -> Int

inRange :: (Pair a b, Pair a b) -> Pair a b -> Bool #

rangeSize :: (Pair a b, Pair a b) -> Int #

unsafeRangeSize :: (Pair a b, Pair a b) -> Int

Generic (Pair a b) Source # 

Associated Types

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

Methods

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

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

(Semigroup a, Semigroup b) => Semigroup (Pair a b) Source # 

Methods

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

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

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

(Monoid a, Monoid b) => Monoid (Pair a b) Source # 

Methods

mempty :: Pair a b #

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

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

type Rep1 (Pair a) Source # 
type Rep1 (Pair a) = D1 (MetaData "Pair" "Data.Strict.Tuple" "strict-base-0.4.0.0-1k3wDu59CS22iu6yIZo2Dn" False) (C1 (MetaCons ":!:" (InfixI LeftAssociative 2) False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 a)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) Par1)))
type Rep (Pair a b) Source # 
type Rep (Pair a b) = D1 (MetaData "Pair" "Data.Strict.Tuple" "strict-base-0.4.0.0-1k3wDu59CS22iu6yIZo2Dn" False) (C1 (MetaCons ":!:" (InfixI LeftAssociative 2) False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 a)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 b))))

type (:!:) = Pair infixl 2 Source #

fst :: Pair a b -> a Source #

Extract the first component of a strict pair.

snd :: Pair a b -> b Source #

Extract the second component of a strict pair.

curry :: (Pair a b -> c) -> a -> b -> c Source #

Curry a function on strict pairs.

uncurry :: (a -> b -> c) -> Pair a b -> c Source #

Convert a curried function to a function on strict pairs.

swap :: Pair a b -> Pair b a Source #

Analagous to swap from Data.Tuple

zip :: [a] -> [b] -> [Pair a b] Source #

Zip for strict pairs (defined with zipWith).

unzip :: [Pair a b] -> ([a], [b]) Source #

Unzip for stict pairs into a (lazy) pair of lists.

Orphan instances

IsStrict (a, b) (Pair a b) Source # 

Methods

fromStrict :: Pair a b -> (a, b) Source #

toStrict :: (a, b) -> Pair a b Source #