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

StableFactorialMonoid 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 #

StableFactorialMonoid 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 #

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

Defined in Data.Monoid.Instances.Measured

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

Defined in Data.Monoid.Instances.Measured

(RightReductiveMonoid a, StableFactorialMonoid a) => RightReductiveMonoid (Measured a) Source # 
Instance details

Defined in Data.Monoid.Instances.Measured

(LeftReductiveMonoid a, StableFactorialMonoid a) => LeftReductiveMonoid (Measured a) Source # 
Instance details

Defined in Data.Monoid.Instances.Measured

StableFactorialMonoid a => PositiveMonoid (Measured a) Source # 
Instance details

Defined in Data.Monoid.Instances.Measured

StableFactorialMonoid a => MonoidNull (Measured a) Source # 
Instance details

Defined in Data.Monoid.Instances.Measured

Methods

null :: Measured a -> Bool Source #

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

Defined in Data.Monoid.Instances.Measured

StableFactorialMonoid a => FactorialMonoid (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 #

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 :: (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 #

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

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 :: FactorialMonoid a => a -> Measured a Source #

Create a new Measured value.