monoid-subclasses-0.4.6: Subclasses of Monoid

Safe HaskellSafe
LanguageHaskell2010

Data.Monoid.Instances.Measured

Description

This module defines the monoid transformer data type Measured.

Synopsis

Documentation

data Measured a Source #

Measured a is a wrapper around the FactorialMonoid a that memoizes the monoid's length so it becomes a constant-time operation. The parameter is restricted to the StableFactorialMonoid class, which guarantees that length (a <> b) == length a + length b.

Instances

Eq a => Eq (Measured a) Source # 

Methods

(==) :: Measured a -> Measured a -> Bool #

(/=) :: Measured a -> Measured a -> Bool #

Ord a => Ord (Measured a) Source # 

Methods

compare :: Measured a -> Measured a -> Ordering #

(<) :: Measured a -> Measured a -> Bool #

(<=) :: Measured a -> Measured a -> Bool #

(>) :: Measured a -> Measured a -> Bool #

(>=) :: Measured a -> Measured a -> Bool #

max :: Measured a -> Measured a -> Measured a #

min :: Measured a -> Measured a -> Measured a #

Show a => Show (Measured a) Source # 

Methods

showsPrec :: Int -> Measured a -> ShowS #

show :: Measured a -> String #

showList :: [Measured a] -> ShowS #

(FactorialMonoid a, IsString a) => IsString (Measured a) Source # 

Methods

fromString :: String -> Measured a #

StableFactorialMonoid a => Semigroup (Measured a) Source # 

Methods

(<>) :: Measured a -> Measured a -> Measured a #

sconcat :: NonEmpty (Measured a) -> Measured a #

stimes :: Integral b => b -> Measured a -> Measured a #

StableFactorialMonoid a => Monoid (Measured a) Source # 

Methods

mempty :: Measured a #

mappend :: Measured a -> Measured a -> Measured a #

mconcat :: [Measured a] -> Measured a #

(RightGCDMonoid a, StableFactorialMonoid a) => RightGCDMonoid (Measured a) Source # 
(LeftGCDMonoid a, StableFactorialMonoid a) => LeftGCDMonoid (Measured a) Source # 
(RightReductiveMonoid a, StableFactorialMonoid a) => RightReductiveMonoid (Measured a) Source # 
(LeftReductiveMonoid a, StableFactorialMonoid a) => LeftReductiveMonoid (Measured a) Source # 
StableFactorialMonoid a => PositiveMonoid (Measured a) Source # 
StableFactorialMonoid a => MonoidNull (Measured a) Source # 

Methods

null :: Measured a -> Bool Source #

StableFactorialMonoid a => StableFactorialMonoid (Measured a) Source # 
StableFactorialMonoid a => FactorialMonoid (Measured a) Source # 

Methods

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

primePrefix :: Measured a -> Measured a Source #

primeSuffix :: Measured a -> Measured a Source #

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

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

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

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

foldl :: (a -> Measured a -> a) -> a -> Measured a -> a Source #

foldl' :: (a -> Measured a -> a) -> a -> Measured a -> a Source #

foldr :: (Measured a -> a -> a) -> a -> Measured a -> a Source #

length :: Measured a -> Int Source #

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

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

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

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

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

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

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

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

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

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

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

reverse :: Measured a -> Measured a Source #

(Eq a, TextualMonoid a, StableFactorialMonoid a) => TextualMonoid (Measured a) Source # 

Methods

fromText :: Text -> Measured a Source #

singleton :: Char -> Measured a Source #

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

characterPrefix :: Measured a -> Maybe Char Source #

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

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

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

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

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

foldl :: (a -> Measured a -> a) -> (a -> Char -> a) -> a -> Measured a -> a Source #

foldl' :: (a -> Measured a -> a) -> (a -> Char -> a) -> a -> Measured a -> a Source #

foldr :: (Measured a -> a -> a) -> (Char -> a -> a) -> a -> Measured a -> a Source #

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

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

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

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

mapAccumL :: (a -> Char -> (a, Char)) -> a -> Measured a -> (a, Measured a) Source #

mapAccumR :: (a -> Char -> (a, Char)) -> a -> Measured a -> (a, Measured a) Source #

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

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

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

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

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

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

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

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

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

foldl_ :: (a -> Char -> a) -> a -> Measured a -> a Source #

foldl_' :: (a -> Char -> a) -> a -> Measured a -> a Source #

foldr_ :: (Char -> a -> a) -> a -> Measured a -> a Source #

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

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

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

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

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

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

measure :: FactorialMonoid a => a -> Measured a Source #

Create a new Measured value.