monoid-subclasses-1.2.6: Subclasses of Monoid

Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.Monoid.Instances.Concat

Description

This module defines the monoid transformer data type `Concat`.

Synopsis

- data Concat a
- concatenate :: PositiveMonoid a => Seq a -> Concat a
- extract :: Concat a -> Seq a
- force :: Semigroup a => Concat a -> a

# Documentation

data Concat a Source #

``Concat`` is a transparent monoid transformer. The behaviour of the ``Concat` a` instances of monoid subclasses is identical to the behaviour of their `a` instances, up to the `pure` isomorphism.

The only purpose of `Concat` then is to change the performance characteristics of various operations. Most importantly, injecting a monoid into `Concat` has the effect of making `mappend` a constant-time operation. The `splitPrimePrefix` and `splitPrimeSuffix` operations are amortized to constant time, provided that only one or the other is used. Using both operations alternately will trigger the worst-case behaviour of O(n).

#### Instances

Instances details

Applicative Concat Source # |
Instance details Defined in Data.Monoid.Instances.Concat Methods pure :: a -> Concat a Source # (<*>) :: Concat (a -> b) -> Concat a -> Concat b Source # liftA2 :: (a -> b -> c) -> Concat a -> Concat b -> Concat c Source # (*>) :: Concat a -> Concat b -> Concat b Source # (<*) :: Concat a -> Concat b -> Concat a Source #
Functor Concat Source # |
Instance details Defined in Data.Monoid.Instances.Concat Methods fmap :: (a -> b) -> Concat a -> Concat b Source # (<$) :: a -> Concat b -> Concat a Source #
Foldable Concat Source # |

Instance details

Defined in Data.Monoid.Instances.Concat

Methods

fold :: Monoid m => Concat m -> m Source #

foldMap :: Monoid m => (a -> m) -> Concat a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Concat a -> m Source #

foldr :: (a -> b -> b) -> b -> Concat a -> b Source #

foldr' :: (a -> b -> b) -> b -> Concat a -> b Source #

foldl :: (b -> a -> b) -> b -> Concat a -> b Source #

foldl' :: (b -> a -> b) -> b -> Concat a -> b Source #

foldr1 :: (a -> a -> a) -> Concat a -> a Source #

foldl1 :: (a -> a -> a) -> Concat a -> a Source #

toList :: Concat a -> [a] Source #

null :: Concat a -> Bool Source #

length :: Concat a -> Int Source #

elem :: Eq a => a -> Concat a -> Bool Source #

maximum :: Ord a => Concat a -> a Source #

minimum :: Ord a => Concat a -> a Source #

sum :: Num a => Concat a -> a Source #

product :: Num a => Concat a -> a Source #

PositiveMonoid a => Monoid (Concat a) Source # |
Instance details Defined in Data.Monoid.Instances.Concat Methods mempty :: Concat a Source # mappend :: Concat a -> Concat a -> Concat a Source # mconcat :: [Concat a] -> Concat a Source #
PositiveMonoid a => Semigroup (Concat a) Source # |
Instance details Defined in Data.Monoid.Instances.Concat Methods (<>) :: Concat a -> Concat a -> Concat a Source # sconcat :: NonEmpty (Concat a) -> Concat a Source # stimes :: Integral b => b -> Concat a -> Concat a Source #
Data a => Data (Concat a) Source # |

Instance details

Defined in Data.Monoid.Instances.Concat

Methods

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

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

toConstr :: Concat a -> Constr Source #

dataTypeOf :: Concat a -> DataType Source #

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

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

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

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

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

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

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

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

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

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

IsString a => IsString (Concat a) Source # |
Instance details Defined in Data.Monoid.Instances.Concat Methods fromString :: String -> Concat a Source #
Show a => Show (Concat a) Source # |
Instance details Defined in Data.Monoid.Instances.Concat Methods showsPrec :: Int -> Concat a -> ShowS Source # show :: Concat a -> String Source # showList :: [Concat a] -> ShowS Source #
(Eq a, Semigroup a) => Eq (Concat a) Source # |
Instance details Defined in Data.Monoid.Instances.Concat Methods (==) :: Concat a -> Concat a -> Bool Source # (/=) :: Concat a -> Concat a -> Bool Source #
(Ord a, Semigroup a) => Ord (Concat a) Source # |
Instance details Defined in Data.Monoid.Instances.Concat Methods compare :: Concat a -> Concat a -> Ordering Source # (<) :: Concat a -> Concat a -> Bool Source # (<=) :: Concat a -> Concat a -> Bool Source # (>) :: Concat a -> Concat a -> Bool Source # (>=) :: Concat a -> Concat a -> Bool Source # max :: Concat a -> Concat a -> Concat a Source # min :: Concat a -> Concat a -> Concat a Source #
(FactorialMonoid a, PositiveMonoid a) => FactorialMonoid (Concat a) Source # |

Instance details

Defined in Data.Monoid.Instances.Concat

Methods

splitPrimePrefix :: Concat a -> Maybe (Concat a, Concat a) Source #

splitPrimeSuffix :: Concat a -> Maybe (Concat a, Concat a) Source #

inits :: Concat a -> [Concat a] Source #

tails :: Concat a -> [Concat a] Source #

span :: (Concat a -> Bool) -> Concat a -> (Concat a, Concat a) Source #

break :: (Concat a -> Bool) -> Concat a -> (Concat a, Concat a) Source #

split :: (Concat a -> Bool) -> Concat a -> [Concat a] Source #

takeWhile :: (Concat a -> Bool) -> Concat a -> Concat a Source #

dropWhile :: (Concat a -> Bool) -> Concat a -> Concat a Source #

spanMaybe :: s -> (s -> Concat a -> Maybe s) -> Concat a -> (Concat a, Concat a, s) Source #

spanMaybe' :: s -> (s -> Concat a -> Maybe s) -> Concat a -> (Concat a, Concat a, s) Source #

splitAt :: Int -> Concat a -> (Concat a, Concat a) Source #

drop :: Int -> Concat a -> Concat a Source #

take :: Int -> Concat a -> Concat a Source #

(LeftGCDMonoid a, StableFactorial a, PositiveMonoid a) => LeftGCDMonoid (Concat a) Source # |
Instance details Defined in Data.Monoid.Instances.Concat Methods commonPrefix :: Concat a -> Concat a -> Concat a Source # stripCommonPrefix :: Concat a -> Concat a -> (Concat a, Concat a, Concat a) Source #
(RightGCDMonoid a, StableFactorial a, PositiveMonoid a) => RightGCDMonoid (Concat a) Source # |
Instance details Defined in Data.Monoid.Instances.Concat Methods commonSuffix :: Concat a -> Concat a -> Concat a Source # stripCommonSuffix :: Concat a -> Concat a -> (Concat a, Concat a, Concat a) Source #
PositiveMonoid a => MonoidNull (Concat a) Source # |
Instance details Defined in Data.Monoid.Instances.Concat Methods null :: Concat a -> Bool Source #
PositiveMonoid a => PositiveMonoid (Concat a) Source # |
Instance details Defined in Data.Monoid.Instances.Concat
(Eq a, TextualMonoid a, StableFactorial a, PositiveMonoid a) => TextualMonoid (Concat a) Source # |

Instance details

Defined in Data.Monoid.Instances.Concat

Methods

fromText :: Text -> Concat a Source #

singleton :: Char -> Concat a Source #

splitCharacterPrefix :: Concat a -> Maybe (Char, Concat a) Source #

characterPrefix :: Concat a -> Maybe Char Source #

map :: (Char -> Char) -> Concat a -> Concat a Source #

concatMap :: (Char -> Concat a) -> Concat a -> Concat a Source #

toString :: (Concat a -> String) -> Concat a -> String Source #

toText :: (Concat a -> Text) -> Concat a -> Text Source #

any :: (Char -> Bool) -> Concat a -> Bool Source #

all :: (Char -> Bool) -> Concat a -> Bool Source #

foldl :: (a0 -> Concat a -> a0) -> (a0 -> Char -> a0) -> a0 -> Concat a -> a0 Source #

foldl' :: (a0 -> Concat a -> a0) -> (a0 -> Char -> a0) -> a0 -> Concat a -> a0 Source #

foldr :: (Concat a -> a0 -> a0) -> (Char -> a0 -> a0) -> a0 -> Concat a -> a0 Source #

scanl :: (Char -> Char -> Char) -> Char -> Concat a -> Concat a Source #

scanl1 :: (Char -> Char -> Char) -> Concat a -> Concat a Source #

scanr :: (Char -> Char -> Char) -> Char -> Concat a -> Concat a Source #

scanr1 :: (Char -> Char -> Char) -> Concat a -> Concat a Source #

mapAccumL :: (a0 -> Char -> (a0, Char)) -> a0 -> Concat a -> (a0, Concat a) Source #

mapAccumR :: (a0 -> Char -> (a0, Char)) -> a0 -> Concat a -> (a0, Concat a) Source #

takeWhile :: (Concat a -> Bool) -> (Char -> Bool) -> Concat a -> Concat a Source #

dropWhile :: (Concat a -> Bool) -> (Char -> Bool) -> Concat a -> Concat a Source #

break :: (Concat a -> Bool) -> (Char -> Bool) -> Concat a -> (Concat a, Concat a) Source #

span :: (Concat a -> Bool) -> (Char -> Bool) -> Concat a -> (Concat a, Concat a) Source #

spanMaybe :: s -> (s -> Concat a -> Maybe s) -> (s -> Char -> Maybe s) -> Concat a -> (Concat a, Concat a, s) Source #

spanMaybe' :: s -> (s -> Concat a -> Maybe s) -> (s -> Char -> Maybe s) -> Concat a -> (Concat a, Concat a, s) Source #

split :: (Char -> Bool) -> Concat a -> [Concat a] Source #

find :: (Char -> Bool) -> Concat a -> Maybe Char Source #

elem :: Char -> Concat a -> Bool Source #

foldl_ :: (a0 -> Char -> a0) -> a0 -> Concat a -> a0 Source #

foldl_' :: (a0 -> Char -> a0) -> a0 -> Concat a -> a0 Source #

foldr_ :: (Char -> a0 -> a0) -> a0 -> Concat a -> a0 Source #

takeWhile_ :: Bool -> (Char -> Bool) -> Concat a -> Concat a Source #

dropWhile_ :: Bool -> (Char -> Bool) -> Concat a -> Concat a Source #

break_ :: Bool -> (Char -> Bool) -> Concat a -> (Concat a, Concat a) Source #

span_ :: Bool -> (Char -> Bool) -> Concat a -> (Concat a, Concat a) Source #

spanMaybe_ :: s -> (s -> Char -> Maybe s) -> Concat a -> (Concat a, Concat a, s) Source #

spanMaybe_' :: s -> (s -> Char -> Maybe s) -> Concat a -> (Concat a, Concat a, s) Source #

(LeftReductive a, StableFactorial a, PositiveMonoid a) => LeftReductive (Concat a) Source # |
Instance details Defined in Data.Monoid.Instances.Concat Methods isPrefixOf :: Concat a -> Concat a -> Bool Source # stripPrefix :: Concat a -> Concat a -> Maybe (Concat a) Source #
(RightReductive a, StableFactorial a, PositiveMonoid a) => RightReductive (Concat a) Source # |
Instance details Defined in Data.Monoid.Instances.Concat Methods isSuffixOf :: Concat a -> Concat a -> Bool Source # stripSuffix :: Concat a -> Concat a -> Maybe (Concat a) Source #
(Factorial a, PositiveMonoid a) => Factorial (Concat a) Source # |

Instance details

Defined in Data.Monoid.Instances.Concat

Methods

factors :: Concat a -> [Concat a] Source #

primePrefix :: Concat a -> Concat a Source #

primeSuffix :: Concat a -> Concat a Source #

foldl :: (a0 -> Concat a -> a0) -> a0 -> Concat a -> a0 Source #

foldl' :: (a0 -> Concat a -> a0) -> a0 -> Concat a -> a0 Source #

foldr :: (Concat a -> a0 -> a0) -> a0 -> Concat a -> a0 Source #

length :: Concat a -> Int Source #

foldMap :: Monoid n => (Concat a -> n) -> Concat a -> n Source #

reverse :: Concat a -> Concat a Source #

(Factorial a, PositiveMonoid a) => StableFactorial (Concat a) Source # |
Instance details Defined in Data.Monoid.Instances.Concat

concatenate :: PositiveMonoid a => Seq a -> Concat a Source #

Deprecated: Concat is not wrapping Seq any more, don't use concatenate nor extract.

extract :: Concat a -> Seq a Source #

Deprecated: Concat is not wrapping Seq any more, don't use concatenate nor extract.

force :: Semigroup a => Concat a -> a Source #