mappings-0.2.1.0: Types which represent functions k -> v
Safe HaskellSafe-Inferred
LanguageGHC2021

Data.Mapping.Piecewise

Synopsis

Documentation

data Piecewise k v Source #

A data structure storing mappings that are constant on intervals.

If the space of keys not discrete, then these mappings are right-continuous: values are in general defined on intervals $a leq x < b$ which are closed on the left and open on the right.

Constructors

Piecewise 

Fields

Instances

Instances details
Ord k => Mapping k (Piecewise k) Source # 
Instance details

Defined in Data.Mapping.Piecewise

Methods

cst :: v -> Piecewise k v Source #

act :: Piecewise k v -> k -> v Source #

isConst :: Ord v => Piecewise k v -> Maybe v Source #

mtraverse :: (Applicative f, Ord v) => (u -> f v) -> Piecewise k u -> f (Piecewise k v) Source #

mmap :: Ord v => (u -> v) -> Piecewise k u -> Piecewise k v Source #

mergeA :: (Applicative f, Ord w) => (u -> v -> f w) -> Piecewise k u -> Piecewise k v -> f (Piecewise k w) Source #

merge :: Ord w => (u -> v -> w) -> Piecewise k u -> Piecewise k v -> Piecewise k w Source #

Foldable (Piecewise k) Source # 
Instance details

Defined in Data.Mapping.Piecewise

Methods

fold :: Monoid m => Piecewise k m -> m #

foldMap :: Monoid m => (a -> m) -> Piecewise k a -> m #

foldMap' :: Monoid m => (a -> m) -> Piecewise k a -> m #

foldr :: (a -> b -> b) -> b -> Piecewise k a -> b #

foldr' :: (a -> b -> b) -> b -> Piecewise k a -> b #

foldl :: (b -> a -> b) -> b -> Piecewise k a -> b #

foldl' :: (b -> a -> b) -> b -> Piecewise k a -> b #

foldr1 :: (a -> a -> a) -> Piecewise k a -> a #

foldl1 :: (a -> a -> a) -> Piecewise k a -> a #

toList :: Piecewise k a -> [a] #

null :: Piecewise k a -> Bool #

length :: Piecewise k a -> Int #

elem :: Eq a => a -> Piecewise k a -> Bool #

maximum :: Ord a => Piecewise k a -> a #

minimum :: Ord a => Piecewise k a -> a #

sum :: Num a => Piecewise k a -> a #

product :: Num a => Piecewise k a -> a #

Neighbourly (Piecewise k) Source # 
Instance details

Defined in Data.Mapping.Piecewise

Methods

neighbours :: Ord v => Piecewise k v -> Set (v, v) Source #

(Ord k, Ord b, Monoid b) => Monoid (Piecewise k b) Source # 
Instance details

Defined in Data.Mapping.Piecewise

Methods

mempty :: Piecewise k b #

mappend :: Piecewise k b -> Piecewise k b -> Piecewise k b #

mconcat :: [Piecewise k b] -> Piecewise k b #

(Ord k, Ord b, Semigroup b) => Semigroup (Piecewise k b) Source # 
Instance details

Defined in Data.Mapping.Piecewise

Methods

(<>) :: Piecewise k b -> Piecewise k b -> Piecewise k b #

sconcat :: NonEmpty (Piecewise k b) -> Piecewise k b #

stimes :: Integral b0 => b0 -> Piecewise k b -> Piecewise k b #

(Ord k, Ord b, Num b) => Num (Piecewise k b) Source # 
Instance details

Defined in Data.Mapping.Piecewise

Methods

(+) :: Piecewise k b -> Piecewise k b -> Piecewise k b #

(-) :: Piecewise k b -> Piecewise k b -> Piecewise k b #

(*) :: Piecewise k b -> Piecewise k b -> Piecewise k b #

negate :: Piecewise k b -> Piecewise k b #

abs :: Piecewise k b -> Piecewise k b #

signum :: Piecewise k b -> Piecewise k b #

fromInteger :: Integer -> Piecewise k b #

(Show k, Show v) => Show (Piecewise k v) Source # 
Instance details

Defined in Data.Mapping.Piecewise

Methods

showsPrec :: Int -> Piecewise k v -> ShowS #

show :: Piecewise k v -> String #

showList :: [Piecewise k v] -> ShowS #

(Ord k, Ord b, Boolean b) => Boolean (Piecewise k b) Source # 
Instance details

Defined in Data.Mapping.Piecewise

Methods

true :: Piecewise k b #

false :: Piecewise k b #

not :: Piecewise k b -> Piecewise k b #

(&&) :: Piecewise k b -> Piecewise k b -> Piecewise k b #

(||) :: Piecewise k b -> Piecewise k b -> Piecewise k b #

xor :: Piecewise k b -> Piecewise k b -> Piecewise k b #

(-->) :: Piecewise k b -> Piecewise k b -> Piecewise k b #

(<-->) :: Piecewise k b -> Piecewise k b -> Piecewise k b #

(Eq v, Eq k) => Eq (Piecewise k v) Source # 
Instance details

Defined in Data.Mapping.Piecewise

Methods

(==) :: Piecewise k v -> Piecewise k v -> Bool #

(/=) :: Piecewise k v -> Piecewise k v -> Bool #

(Ord v, Ord k) => Ord (Piecewise k v) Source # 
Instance details

Defined in Data.Mapping.Piecewise

Methods

compare :: Piecewise k v -> Piecewise k v -> Ordering #

(<) :: Piecewise k v -> Piecewise k v -> Bool #

(<=) :: Piecewise k v -> Piecewise k v -> Bool #

(>) :: Piecewise k v -> Piecewise k v -> Bool #

(>=) :: Piecewise k v -> Piecewise k v -> Bool #

max :: Piecewise k v -> Piecewise k v -> Piecewise k v #

min :: Piecewise k v -> Piecewise k v -> Piecewise k v #

piecewiseFromAsc :: Eq k => v -> [(k, v)] -> Piecewise k v Source #

changeAt :: v -> k -> v -> Piecewise k v Source #

fromAscList :: (Ord k, Eq v) => v -> [(k, v)] -> Piecewise k v Source #

values :: Piecewise k v -> [v] Source #