monoid-subclasses-1.2.6: Subclasses of Monoid

Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.Monoid.Instances.PrefixMemory

Description

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

Synopsis

- data Shadowed m
- shadowed :: Monoid m => m -> Shadowed m
- content :: Shadowed m -> m
- prefix :: Shadowed m -> m

# Documentation

data Shadowed m Source #

Monoid transformer that keeps track of the former `prefix` of its `content`. All functions that return a suffix of their argument, such as `stripPrefix` or `commonSuffix`, preserve the discarded `prefix`.

#### Instances

Instances details

(MonoidNull m, StableFactorial m) => Monoid (Shadowed m) Source # |
Instance details Defined in Data.Monoid.Instances.PrefixMemory Methods mempty :: Shadowed m Source # mappend :: Shadowed m -> Shadowed m -> Shadowed m Source # mconcat :: [Shadowed m] -> Shadowed m Source #
(MonoidNull m, StableFactorial m) => Semigroup (Shadowed m) Source # |
Instance details Defined in Data.Monoid.Instances.PrefixMemory Methods (<>) :: Shadowed m -> Shadowed m -> Shadowed m Source # sconcat :: NonEmpty (Shadowed m) -> Shadowed m Source # stimes :: Integral b => b -> Shadowed m -> Shadowed m Source #
Data m => Data (Shadowed m) Source # |

Instance details

Defined in Data.Monoid.Instances.PrefixMemory

Methods

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

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

toConstr :: Shadowed m -> Constr Source #

dataTypeOf :: Shadowed m -> DataType Source #

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

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

gmapT :: (forall b. Data b => b -> b) -> Shadowed m -> Shadowed m Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Shadowed m -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Shadowed m -> r Source #

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

gmapQi :: Int -> (forall d. Data d => d -> u) -> Shadowed m -> u Source #

gmapM :: Monad m0 => (forall d. Data d => d -> m0 d) -> Shadowed m -> m0 (Shadowed m) Source #

gmapMp :: MonadPlus m0 => (forall d. Data d => d -> m0 d) -> Shadowed m -> m0 (Shadowed m) Source #

gmapMo :: MonadPlus m0 => (forall d. Data d => d -> m0 d) -> Shadowed m -> m0 (Shadowed m) Source #

(Monoid m, IsString m) => IsString (Shadowed m) Source # |
Instance details Defined in Data.Monoid.Instances.PrefixMemory Methods fromString :: String -> Shadowed m Source #
(MonoidNull m, Show m) => Show (Shadowed m) Source # |
Instance details Defined in Data.Monoid.Instances.PrefixMemory Methods showsPrec :: Int -> Shadowed m -> ShowS Source # show :: Shadowed m -> String Source # showList :: [Shadowed m] -> ShowS Source #
Eq m => Eq (Shadowed m) Source # |
Instance details Defined in Data.Monoid.Instances.PrefixMemory Methods (==) :: Shadowed m -> Shadowed m -> Bool Source # (/=) :: Shadowed m -> Shadowed m -> Bool Source #
Ord m => Ord (Shadowed m) Source # |

Instance details

Defined in Data.Monoid.Instances.PrefixMemory

Methods

compare :: Shadowed m -> Shadowed m -> Ordering Source #

(<) :: Shadowed m -> Shadowed m -> Bool Source #

(<=) :: Shadowed m -> Shadowed m -> Bool Source #

(>) :: Shadowed m -> Shadowed m -> Bool Source #

(>=) :: Shadowed m -> Shadowed m -> Bool Source #

max :: Shadowed m -> Shadowed m -> Shadowed m Source #

min :: Shadowed m -> Shadowed m -> Shadowed m Source #

(StableFactorial m, FactorialMonoid m) => FactorialMonoid (Shadowed m) Source # |

Instance details

Defined in Data.Monoid.Instances.PrefixMemory

Methods

splitPrimePrefix :: Shadowed m -> Maybe (Shadowed m, Shadowed m) Source #

splitPrimeSuffix :: Shadowed m -> Maybe (Shadowed m, Shadowed m) Source #

inits :: Shadowed m -> [Shadowed m] Source #

tails :: Shadowed m -> [Shadowed m] Source #

span :: (Shadowed m -> Bool) -> Shadowed m -> (Shadowed m, Shadowed m) Source #

break :: (Shadowed m -> Bool) -> Shadowed m -> (Shadowed m, Shadowed m) Source #

split :: (Shadowed m -> Bool) -> Shadowed m -> [Shadowed m] Source #

takeWhile :: (Shadowed m -> Bool) -> Shadowed m -> Shadowed m Source #

dropWhile :: (Shadowed m -> Bool) -> Shadowed m -> Shadowed m Source #

spanMaybe :: s -> (s -> Shadowed m -> Maybe s) -> Shadowed m -> (Shadowed m, Shadowed m, s) Source #

spanMaybe' :: s -> (s -> Shadowed m -> Maybe s) -> Shadowed m -> (Shadowed m, Shadowed m, s) Source #

splitAt :: Int -> Shadowed m -> (Shadowed m, Shadowed m) Source #

drop :: Int -> Shadowed m -> Shadowed m Source #

take :: Int -> Shadowed m -> Shadowed m Source #

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

Instance details

Defined in Data.Monoid.Instances.PrefixMemory

Methods

fromText :: Text -> Shadowed m Source #

singleton :: Char -> Shadowed m Source #

splitCharacterPrefix :: Shadowed m -> Maybe (Char, Shadowed m) Source #

characterPrefix :: Shadowed m -> Maybe Char Source #

map :: (Char -> Char) -> Shadowed m -> Shadowed m Source #

concatMap :: (Char -> Shadowed m) -> Shadowed m -> Shadowed m Source #

toString :: (Shadowed m -> String) -> Shadowed m -> String Source #

toText :: (Shadowed m -> Text) -> Shadowed m -> Text Source #

any :: (Char -> Bool) -> Shadowed m -> Bool Source #

all :: (Char -> Bool) -> Shadowed m -> Bool Source #

foldl :: (a -> Shadowed m -> a) -> (a -> Char -> a) -> a -> Shadowed m -> a Source #

foldl' :: (a -> Shadowed m -> a) -> (a -> Char -> a) -> a -> Shadowed m -> a Source #

foldr :: (Shadowed m -> a -> a) -> (Char -> a -> a) -> a -> Shadowed m -> a Source #

scanl :: (Char -> Char -> Char) -> Char -> Shadowed m -> Shadowed m Source #

scanl1 :: (Char -> Char -> Char) -> Shadowed m -> Shadowed m Source #

scanr :: (Char -> Char -> Char) -> Char -> Shadowed m -> Shadowed m Source #

scanr1 :: (Char -> Char -> Char) -> Shadowed m -> Shadowed m Source #

mapAccumL :: (a -> Char -> (a, Char)) -> a -> Shadowed m -> (a, Shadowed m) Source #

mapAccumR :: (a -> Char -> (a, Char)) -> a -> Shadowed m -> (a, Shadowed m) Source #

takeWhile :: (Shadowed m -> Bool) -> (Char -> Bool) -> Shadowed m -> Shadowed m Source #

dropWhile :: (Shadowed m -> Bool) -> (Char -> Bool) -> Shadowed m -> Shadowed m Source #

break :: (Shadowed m -> Bool) -> (Char -> Bool) -> Shadowed m -> (Shadowed m, Shadowed m) Source #

span :: (Shadowed m -> Bool) -> (Char -> Bool) -> Shadowed m -> (Shadowed m, Shadowed m) Source #

spanMaybe :: s -> (s -> Shadowed m -> Maybe s) -> (s -> Char -> Maybe s) -> Shadowed m -> (Shadowed m, Shadowed m, s) Source #

spanMaybe' :: s -> (s -> Shadowed m -> Maybe s) -> (s -> Char -> Maybe s) -> Shadowed m -> (Shadowed m, Shadowed m, s) Source #

split :: (Char -> Bool) -> Shadowed m -> [Shadowed m] Source #

find :: (Char -> Bool) -> Shadowed m -> Maybe Char Source #

elem :: Char -> Shadowed m -> Bool Source #

foldl_ :: (a -> Char -> a) -> a -> Shadowed m -> a Source #

foldl_' :: (a -> Char -> a) -> a -> Shadowed m -> a Source #

foldr_ :: (Char -> a -> a) -> a -> Shadowed m -> a Source #

takeWhile_ :: Bool -> (Char -> Bool) -> Shadowed m -> Shadowed m Source #

dropWhile_ :: Bool -> (Char -> Bool) -> Shadowed m -> Shadowed m Source #

break_ :: Bool -> (Char -> Bool) -> Shadowed m -> (Shadowed m, Shadowed m) Source #

span_ :: Bool -> (Char -> Bool) -> Shadowed m -> (Shadowed m, Shadowed m) Source #

spanMaybe_ :: s -> (s -> Char -> Maybe s) -> Shadowed m -> (Shadowed m, Shadowed m, s) Source #

spanMaybe_' :: s -> (s -> Char -> Maybe s) -> Shadowed m -> (Shadowed m, Shadowed m, s) Source #

(MonoidNull m, StableFactorial m, LeftReductive m) => LeftReductive (Shadowed m) Source # |
Instance details Defined in Data.Monoid.Instances.PrefixMemory Methods isPrefixOf :: Shadowed m -> Shadowed m -> Bool Source # stripPrefix :: Shadowed m -> Shadowed m -> Maybe (Shadowed m) Source #
(StableFactorial m, FactorialMonoid m, RightReductive m) => RightReductive (Shadowed m) Source # |
Instance details Defined in Data.Monoid.Instances.PrefixMemory Methods isSuffixOf :: Shadowed m -> Shadowed m -> Bool Source # stripSuffix :: Shadowed m -> Shadowed m -> Maybe (Shadowed m) Source #
(FactorialMonoid m, StableFactorial m) => Factorial (Shadowed m) Source # |

Instance details

Defined in Data.Monoid.Instances.PrefixMemory

Methods

factors :: Shadowed m -> [Shadowed m] Source #

primePrefix :: Shadowed m -> Shadowed m Source #

primeSuffix :: Shadowed m -> Shadowed m Source #

foldl :: (a -> Shadowed m -> a) -> a -> Shadowed m -> a Source #

foldl' :: (a -> Shadowed m -> a) -> a -> Shadowed m -> a Source #

foldr :: (Shadowed m -> a -> a) -> a -> Shadowed m -> a Source #

length :: Shadowed m -> Int Source #

foldMap :: Monoid n => (Shadowed m -> n) -> Shadowed m -> n Source #

reverse :: Shadowed m -> Shadowed m Source #

(StableFactorial m, FactorialMonoid m) => StableFactorial (Shadowed m) Source # |
Instance details Defined in Data.Monoid.Instances.PrefixMemory

shadowed :: Monoid m => m -> Shadowed m Source #

The constructor of a `Shadowed` monoid, with the initial `prefix = null`

content :: Shadowed m -> m Source #

the present value

prefix :: Shadowed m -> m Source #

used to precede the `content` but has been consumed