Data.Monoid.Instances.Concat

monoid-subclasses-0.4.3.1: Subclasses of Monoid

Safe Haskell | Safe
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 :: Monoid 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

Functor Concat # |
Methods fmap :: (a -> b) -> Concat a -> Concat b # (<$) :: a -> Concat b -> Concat a #
Applicative Concat # |
Methods pure :: a -> Concat a # (<*>) :: Concat (a -> b) -> Concat a -> Concat b # (*>) :: Concat a -> Concat b -> Concat b # (<*) :: Concat a -> Concat b -> Concat a #
Foldable Concat # |
Methods fold :: Monoid m => Concat m -> 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 #
(Eq a, Monoid a) => Eq (Concat a) # |
Methods (==) :: Concat a -> Concat a -> Bool # (/=) :: Concat a -> Concat a -> Bool #
(Ord a, Monoid a) => Ord (Concat a) # |
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 #
Show a => Show (Concat a) # |
Methods showsPrec :: Int -> Concat a -> ShowS # show :: Concat a -> String # showList :: [Concat a] -> ShowS #
IsString a => IsString (Concat a) # |
Methods fromString :: String -> Concat a #
PositiveMonoid a => Monoid (Concat a) # |
Methods mempty :: Concat a # mappend :: Concat a -> Concat a -> Concat a # mconcat :: [Concat a] -> Concat a #
PositiveMonoid a => PositiveMonoid (Concat a) # |
PositiveMonoid a => MonoidNull (Concat a) # |
Methods null :: Concat a -> Bool #
(FactorialMonoid a, PositiveMonoid a) => StableFactorialMonoid (Concat a) # |
(FactorialMonoid a, PositiveMonoid a) => FactorialMonoid (Concat a) # |
Methods factors :: Concat a -> [Concat a] # primePrefix :: Concat a -> Concat a # primeSuffix :: Concat a -> Concat a # 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] # foldl :: (a -> Concat a -> a) -> a -> Concat a -> a # foldl' :: (a -> Concat a -> a) -> a -> Concat a -> a # foldr :: (Concat a -> a -> a) -> a -> Concat a -> a # length :: Concat a -> Int # foldMap :: Monoid n => (Concat a -> n) -> Concat a -> n # 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 # reverse :: Concat a -> Concat a #
(RightGCDMonoid a, StableFactorialMonoid a) => RightGCDMonoid (Concat a) # |
Methods commonSuffix :: Concat a -> Concat a -> Concat a # stripCommonSuffix :: Concat a -> Concat a -> (Concat a, Concat a, Concat a) #
(LeftGCDMonoid a, StableFactorialMonoid a) => LeftGCDMonoid (Concat a) # |
Methods commonPrefix :: Concat a -> Concat a -> Concat a # stripCommonPrefix :: Concat a -> Concat a -> (Concat a, Concat a, Concat a) #
(RightReductiveMonoid a, StableFactorialMonoid a) => RightReductiveMonoid (Concat a) # |
Methods isSuffixOf :: Concat a -> Concat a -> Bool # stripSuffix :: Concat a -> Concat a -> Maybe (Concat a) #
(LeftReductiveMonoid a, StableFactorialMonoid a) => LeftReductiveMonoid (Concat a) # |
Methods isPrefixOf :: Concat a -> Concat a -> Bool # stripPrefix :: Concat a -> Concat a -> Maybe (Concat a) #
(Eq a, TextualMonoid a, StableFactorialMonoid a) => TextualMonoid (Concat a) # |
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 # any :: (Char -> Bool) -> Concat a -> Bool # all :: (Char -> Bool) -> Concat a -> Bool # foldl :: (a -> Concat a -> a) -> (a -> Char -> a) -> a -> Concat a -> a # foldl' :: (a -> Concat a -> a) -> (a -> Char -> a) -> a -> Concat a -> a # foldr :: (Concat a -> a -> a) -> (Char -> a -> a) -> a -> Concat a -> a # 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 :: (a -> Char -> (a, Char)) -> a -> Concat a -> (a, Concat a) # mapAccumR :: (a -> Char -> (a, Char)) -> a -> Concat a -> (a, 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_ :: (a -> Char -> a) -> a -> Concat a -> a # foldl_' :: (a -> Char -> a) -> a -> Concat a -> a # foldr_ :: (Char -> a -> a) -> a -> Concat a -> a # 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) #

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 :: Monoid a => Concat a -> a #