Data.Monoid.Instances.Concat

monoid-subclasses-1.2.5.1: 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 #

``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 # |
Instance details Defined in Data.Monoid.Instances.Concat Methods pure :: a -> Concat a # (<*>) :: Concat (a -> b) -> Concat a -> Concat b # liftA2 :: (a -> b -> c) -> Concat a -> Concat b -> Concat c # (*>) :: Concat a -> Concat b -> Concat b # (<*) :: Concat a -> Concat b -> Concat a #
Functor Concat # |
Instance details Defined in Data.Monoid.Instances.Concat Methods fmap :: (a -> b) -> Concat a -> Concat b # (<$) :: a -> Concat b -> Concat a #
Foldable Concat # |
Instance details Defined in Data.Monoid.Instances.Concat Methods fold :: Monoid m => Concat m -> m # foldMap :: Monoid m => (a -> m) -> Concat a -> m # foldMap' :: Monoid m => (a -> m) -> Concat a -> m # foldr :: (a -> b -> b) -> b -> Concat a -> b # foldr' :: (a -> b -> b) -> b -> Concat a -> b # foldl :: (b -> a -> b) -> b -> Concat a -> b # foldl' :: (b -> a -> b) -> b -> Concat a -> b # foldr1 :: (a -> a -> a) -> Concat a -> a # foldl1 :: (a -> a -> a) -> Concat a -> a # toList :: Concat a -> [a] # null :: Concat a -> Bool # length :: Concat a -> Int # elem :: Eq a => a -> Concat a -> Bool # maximum :: Ord a => Concat a -> a # minimum :: Ord a => Concat a -> a # sum :: Num a => Concat a -> a # product :: Num a => Concat a -> a #
PositiveMonoid a => Monoid (Concat a) # |
Instance details Defined in Data.Monoid.Instances.Concat Methods mempty :: Concat a # mappend :: Concat a -> Concat a -> Concat a # mconcat :: [Concat a] -> Concat a #
PositiveMonoid a => Semigroup (Concat a) # |
Instance details Defined in Data.Monoid.Instances.Concat Methods (<>) :: Concat a -> Concat a -> Concat a # sconcat :: NonEmpty (Concat a) -> Concat a # stimes :: Integral b => b -> Concat a -> Concat a #
Data a => Data (Concat a) # |
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) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Concat a) # toConstr :: Concat a -> Constr # dataTypeOf :: Concat a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Concat a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Concat a)) # gmapT :: (forall b. Data b => b -> b) -> Concat a -> Concat a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Concat a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Concat a -> r # gmapQ :: (forall d. Data d => d -> u) -> Concat a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Concat a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Concat a -> m (Concat a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Concat a -> m (Concat a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Concat a -> m (Concat a) #
IsString a => IsString (Concat a) # |
Instance details Defined in Data.Monoid.Instances.Concat Methods fromString :: String -> Concat a #
Show a => Show (Concat a) # |
Instance details Defined in Data.Monoid.Instances.Concat Methods showsPrec :: Int -> Concat a -> ShowS # show :: Concat a -> String # showList :: [Concat a] -> ShowS #
(Eq a, Semigroup a) => Eq (Concat a) # |
Instance details Defined in Data.Monoid.Instances.Concat Methods (==) :: Concat a -> Concat a -> Bool # (/=) :: Concat a -> Concat a -> Bool #
(Ord a, Semigroup a) => Ord (Concat a) # |
Instance details Defined in Data.Monoid.Instances.Concat Methods compare :: Concat a -> Concat a -> Ordering # (<) :: Concat a -> Concat a -> Bool # (<=) :: Concat a -> Concat a -> Bool # (>) :: Concat a -> Concat a -> Bool # (>=) :: Concat a -> Concat a -> Bool # max :: Concat a -> Concat a -> Concat a # min :: Concat a -> Concat a -> Concat a #
(FactorialMonoid a, PositiveMonoid a) => FactorialMonoid (Concat a) # |
Instance details Defined in Data.Monoid.Instances.Concat Methods splitPrimePrefix :: Concat a -> Maybe (Concat a, Concat a) # splitPrimeSuffix :: Concat a -> Maybe (Concat a, Concat a) # inits :: Concat a -> [Concat a] # tails :: Concat a -> [Concat a] # span :: (Concat a -> Bool) -> Concat a -> (Concat a, Concat a) # break :: (Concat a -> Bool) -> Concat a -> (Concat a, Concat a) # split :: (Concat a -> Bool) -> Concat a -> [Concat a] # takeWhile :: (Concat a -> Bool) -> Concat a -> Concat a # dropWhile :: (Concat a -> Bool) -> Concat a -> Concat a # spanMaybe :: s -> (s -> Concat a -> Maybe s) -> Concat a -> (Concat a, Concat a, s) # spanMaybe' :: s -> (s -> Concat a -> Maybe s) -> Concat a -> (Concat a, Concat a, s) # splitAt :: Int -> Concat a -> (Concat a, Concat a) # drop :: Int -> Concat a -> Concat a # take :: Int -> Concat a -> Concat a #
(LeftGCDMonoid a, StableFactorial a, PositiveMonoid a) => LeftGCDMonoid (Concat a) # |
Instance details Defined in Data.Monoid.Instances.Concat Methods commonPrefix :: Concat a -> Concat a -> Concat a # stripCommonPrefix :: Concat a -> Concat a -> (Concat a, Concat a, Concat a) #
(RightGCDMonoid a, StableFactorial a, PositiveMonoid a) => RightGCDMonoid (Concat a) # |
Instance details Defined in Data.Monoid.Instances.Concat Methods commonSuffix :: Concat a -> Concat a -> Concat a # stripCommonSuffix :: Concat a -> Concat a -> (Concat a, Concat a, Concat a) #
PositiveMonoid a => MonoidNull (Concat a) # |
Instance details Defined in Data.Monoid.Instances.Concat Methods null :: Concat a -> Bool #
PositiveMonoid a => PositiveMonoid (Concat a) # |
Instance details Defined in Data.Monoid.Instances.Concat
(Eq a, TextualMonoid a, StableFactorial a, PositiveMonoid a) => TextualMonoid (Concat a) # |
Instance details Defined in Data.Monoid.Instances.Concat Methods fromText :: Text -> Concat a # singleton :: Char -> Concat a # splitCharacterPrefix :: Concat a -> Maybe (Char, Concat a) # characterPrefix :: Concat a -> Maybe Char # map :: (Char -> Char) -> Concat a -> Concat a # concatMap :: (Char -> Concat a) -> Concat a -> Concat a # toString :: (Concat a -> String) -> Concat a -> String # toText :: (Concat a -> Text) -> Concat a -> Text # any :: (Char -> Bool) -> Concat a -> Bool # all :: (Char -> Bool) -> Concat a -> Bool # foldl :: (a0 -> Concat a -> a0) -> (a0 -> Char -> a0) -> a0 -> Concat a -> a0 # foldl' :: (a0 -> Concat a -> a0) -> (a0 -> Char -> a0) -> a0 -> Concat a -> a0 # foldr :: (Concat a -> a0 -> a0) -> (Char -> a0 -> a0) -> a0 -> Concat a -> a0 # scanl :: (Char -> Char -> Char) -> Char -> Concat a -> Concat a # scanl1 :: (Char -> Char -> Char) -> Concat a -> Concat a # scanr :: (Char -> Char -> Char) -> Char -> Concat a -> Concat a # scanr1 :: (Char -> Char -> Char) -> Concat a -> Concat a # mapAccumL :: (a0 -> Char -> (a0, Char)) -> a0 -> Concat a -> (a0, Concat a) # mapAccumR :: (a0 -> Char -> (a0, Char)) -> a0 -> Concat a -> (a0, Concat a) # takeWhile :: (Concat a -> Bool) -> (Char -> Bool) -> Concat a -> Concat a # dropWhile :: (Concat a -> Bool) -> (Char -> Bool) -> Concat a -> Concat a # break :: (Concat a -> Bool) -> (Char -> Bool) -> Concat a -> (Concat a, Concat a) # span :: (Concat a -> Bool) -> (Char -> Bool) -> Concat a -> (Concat a, Concat a) # spanMaybe :: s -> (s -> Concat a -> Maybe s) -> (s -> Char -> Maybe s) -> Concat a -> (Concat a, Concat a, s) # spanMaybe' :: s -> (s -> Concat a -> Maybe s) -> (s -> Char -> Maybe s) -> Concat a -> (Concat a, Concat a, s) # split :: (Char -> Bool) -> Concat a -> [Concat a] # find :: (Char -> Bool) -> Concat a -> Maybe Char # elem :: Char -> Concat a -> Bool # foldl_ :: (a0 -> Char -> a0) -> a0 -> Concat a -> a0 # foldl_' :: (a0 -> Char -> a0) -> a0 -> Concat a -> a0 # foldr_ :: (Char -> a0 -> a0) -> a0 -> Concat a -> a0 # takeWhile_ :: Bool -> (Char -> Bool) -> Concat a -> Concat a # dropWhile_ :: Bool -> (Char -> Bool) -> Concat a -> Concat a # break_ :: Bool -> (Char -> Bool) -> Concat a -> (Concat a, Concat a) # span_ :: Bool -> (Char -> Bool) -> Concat a -> (Concat a, Concat a) # spanMaybe_ :: s -> (s -> Char -> Maybe s) -> Concat a -> (Concat a, Concat a, s) # spanMaybe_' :: s -> (s -> Char -> Maybe s) -> Concat a -> (Concat a, Concat a, s) #
(LeftReductive a, StableFactorial a, PositiveMonoid a) => LeftReductive (Concat a) # |
Instance details Defined in Data.Monoid.Instances.Concat Methods isPrefixOf :: Concat a -> Concat a -> Bool # stripPrefix :: Concat a -> Concat a -> Maybe (Concat a) #
(RightReductive a, StableFactorial a, PositiveMonoid a) => RightReductive (Concat a) # |
Instance details Defined in Data.Monoid.Instances.Concat Methods isSuffixOf :: Concat a -> Concat a -> Bool # stripSuffix :: Concat a -> Concat a -> Maybe (Concat a) #
(Factorial a, PositiveMonoid a) => Factorial (Concat a) # |
Instance details Defined in Data.Monoid.Instances.Concat Methods factors :: Concat a -> [Concat a] # primePrefix :: Concat a -> Concat a # primeSuffix :: Concat a -> Concat a # foldl :: (a0 -> Concat a -> a0) -> a0 -> Concat a -> a0 # foldl' :: (a0 -> Concat a -> a0) -> a0 -> Concat a -> a0 # foldr :: (Concat a -> a0 -> a0) -> a0 -> Concat a -> a0 # length :: Concat a -> Int # foldMap :: Monoid n => (Concat a -> n) -> Concat a -> n # reverse :: Concat a -> Concat a #
(Factorial a, PositiveMonoid a) => StableFactorial (Concat a) # |
Instance details Defined in Data.Monoid.Instances.Concat

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

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

extract :: Concat a -> Seq a #

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

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