monoid-subclasses-1.1: Subclasses of Monoid
Safe HaskellSafe-Inferred
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 StableFactorial class, which guarantees that length (a <> b) == length a + length b.

Instances

Instances details
Eq a => Eq (Measured a) Source # 
Instance details

Defined in Data.Monoid.Instances.Measured

Methods

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

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

Ord a => Ord (Measured a) Source # 
Instance details

Defined in Data.Monoid.Instances.Measured

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 # 
Instance details

Defined in Data.Monoid.Instances.Measured

Methods

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

show :: Measured a -> String #

showList :: [Measured a] -> ShowS #

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

Defined in Data.Monoid.Instances.Measured

Methods

fromString :: String -> Measured a #

StableFactorial a => Semigroup (Measured a) Source # 
Instance details

Defined in Data.Monoid.Instances.Measured

Methods

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

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

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

(StableFactorial a, Monoid a) => Monoid (Measured a) Source # 
Instance details

Defined in Data.Monoid.Instances.Measured

Methods

mempty :: Measured a #

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

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

(StableFactorial a, Monoid a) => PositiveMonoid (Measured a) Source # 
Instance details

Defined in Data.Monoid.Instances.Measured

(StableFactorial a, Monoid a) => MonoidNull (Measured a) Source # 
Instance details

Defined in Data.Monoid.Instances.Measured

Methods

null :: Measured a -> Bool Source #

(RightReductive a, StableFactorial a) => RightReductive (Measured a) Source # 
Instance details

Defined in Data.Monoid.Instances.Measured

(LeftReductive a, StableFactorial a) => LeftReductive (Measured a) Source # 
Instance details

Defined in Data.Monoid.Instances.Measured

(RightGCDMonoid a, StableFactorial a) => RightGCDMonoid (Measured a) Source # 
Instance details

Defined in Data.Monoid.Instances.Measured

(LeftGCDMonoid a, StableFactorial a) => LeftGCDMonoid (Measured a) Source # 
Instance details

Defined in Data.Monoid.Instances.Measured

(StableFactorial a, MonoidNull a) => StableFactorial (Measured a) Source # 
Instance details

Defined in Data.Monoid.Instances.Measured

(StableFactorial a, MonoidNull a) => Factorial (Measured a) Source # 
Instance details

Defined in Data.Monoid.Instances.Measured

Methods

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

primePrefix :: Measured a -> Measured a Source #

primeSuffix :: Measured a -> Measured a Source #

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

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

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

length :: Measured a -> Int Source #

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

reverse :: Measured a -> Measured a Source #

(StableFactorial a, FactorialMonoid a) => FactorialMonoid (Measured a) Source # 
Instance details

Defined in Data.Monoid.Instances.Measured

(Eq a, StableFactorial a, TextualMonoid a) => TextualMonoid (Measured a) Source # 
Instance details

Defined in Data.Monoid.Instances.Measured

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 #

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

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

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

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

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

foldr :: (Measured a -> a0 -> a0) -> (Char -> a0 -> a0) -> a0 -> Measured a -> a0 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 :: (a0 -> Char -> (a0, Char)) -> a0 -> Measured a -> (a0, Measured a) Source #

mapAccumR :: (a0 -> Char -> (a0, Char)) -> a0 -> Measured a -> (a0, 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_ :: (a0 -> Char -> a0) -> a0 -> Measured a -> a0 Source #

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

foldr_ :: (Char -> a0 -> a0) -> a0 -> Measured a -> a0 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 :: Factorial a => a -> Measured a Source #

Create a new Measured value.