monoid-subclasses-0.4.3.1: Subclasses of Monoid

Safe HaskellTrustworthy
LanguageHaskell2010

Data.Monoid.Factorial

Contents

Description

This module defines the FactorialMonoid class and some of its instances.

Synopsis

Classes

class MonoidNull m => FactorialMonoid m where #

Class of monoids that can be split into irreducible (i.e., atomic or prime) factors in a unique way. Factors of a Product are literally its prime factors:

factors (Product 12) == [Product 2, Product 2, Product 3]

Factors of a list are not its elements but all its single-item sublists:

factors "abc" == ["a", "b", "c"]

The methods of this class satisfy the following laws:

mconcat . factors == id
null == List.null . factors
List.all (\prime-> factors prime == [prime]) . factors
factors == unfoldr splitPrimePrefix == List.reverse . unfoldr (fmap swap . splitPrimeSuffix)
reverse == mconcat . List.reverse . factors
primePrefix == maybe mempty fst . splitPrimePrefix
primeSuffix == maybe mempty snd . splitPrimeSuffix
inits == List.map mconcat . List.inits . factors
tails == List.map mconcat . List.tails . factors
foldl f a == List.foldl f a . factors
foldl' f a == List.foldl' f a . factors
foldr f a == List.foldr f a . factors
span p m == (mconcat l, mconcat r) where (l, r) = List.span p (factors m)
List.all (List.all (not . pred) . factors) . split pred
mconcat . intersperse prime . split (== prime) == id
splitAt i m == (mconcat l, mconcat r) where (l, r) = List.splitAt i (factors m)
spanMaybe () (const $ bool Nothing (Maybe ()) . p) m == (takeWhile p m, dropWhile p m, ())
spanMaybe s0 (\s m-> Just $ f s m) m0 == (m0, mempty, foldl f s0 m0)
let (prefix, suffix, s') = spanMaybe s f m
    foldMaybe = foldl g (Just s)
    g s m = s >>= flip f m
in all ((Nothing ==) . foldMaybe) (inits prefix)
   && prefix == last (filter (isJust . foldMaybe) $ inits m)
   && Just s' == foldMaybe prefix
   && m == prefix <> suffix

A minimal instance definition must implement factors or splitPrimePrefix. Other methods are provided and should be implemented only for performance reasons.

Minimal complete definition

factors | splitPrimePrefix

Methods

factors :: m -> [m] #

Returns a list of all prime factors; inverse of mconcat.

primePrefix :: m -> m #

The prime prefix, mempty if none.

primeSuffix :: m -> m #

The prime suffix, mempty if none.

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

Splits the argument into its prime prefix and the remaining suffix. Returns Nothing for mempty.

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

Splits the argument into its prime suffix and the remaining prefix. Returns Nothing for mempty.

inits :: m -> [m] #

Returns the list of all prefixes of the argument, mempty first.

tails :: m -> [m] #

Returns the list of all suffixes of the argument, mempty last.

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

Like foldl from Data.List on the list of primes.

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

Like foldl' from Data.List on the list of primes.

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

Like foldr from Data.List on the list of primes.

length :: m -> Int #

The length of the list of primes.

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

Generalizes foldMap from Data.Foldable, except the function arguments are prime factors rather than the structure elements.

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

Like span from Data.List on the list of primes.

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

Equivalent to break from Data.List.

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

Splits the monoid into components delimited by prime separators satisfying the given predicate. The primes satisfying the predicate are not a part of the result.

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

Equivalent to takeWhile from Data.List.

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

Equivalent to dropWhile from Data.List.

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

A stateful variant of span, threading the result of the test function as long as it returns Just.

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

Strict version of spanMaybe.

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

Like splitAt from Data.List on the list of primes.

drop :: Int -> m -> m #

Equivalent to drop from Data.List.

take :: Int -> m -> m #

Equivalent to take from Data.List.

reverse :: m -> m #

Equivalent to reverse from Data.List.

Instances

FactorialMonoid () # 

Methods

factors :: () -> [()] #

primePrefix :: () -> () #

primeSuffix :: () -> () #

splitPrimePrefix :: () -> Maybe ((), ()) #

splitPrimeSuffix :: () -> Maybe ((), ()) #

inits :: () -> [()] #

tails :: () -> [()] #

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

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

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

length :: () -> Int #

foldMap :: Monoid n => (() -> n) -> () -> n #

span :: (() -> Bool) -> () -> ((), ()) #

break :: (() -> Bool) -> () -> ((), ()) #

split :: (() -> Bool) -> () -> [()] #

takeWhile :: (() -> Bool) -> () -> () #

dropWhile :: (() -> Bool) -> () -> () #

spanMaybe :: s -> (s -> () -> Maybe s) -> () -> ((), (), s) #

spanMaybe' :: s -> (s -> () -> Maybe s) -> () -> ((), (), s) #

splitAt :: Int -> () -> ((), ()) #

drop :: Int -> () -> () #

take :: Int -> () -> () #

reverse :: () -> () #

FactorialMonoid ByteString # 
FactorialMonoid ByteString # 
FactorialMonoid IntSet # 

Methods

factors :: IntSet -> [IntSet] #

primePrefix :: IntSet -> IntSet #

primeSuffix :: IntSet -> IntSet #

splitPrimePrefix :: IntSet -> Maybe (IntSet, IntSet) #

splitPrimeSuffix :: IntSet -> Maybe (IntSet, IntSet) #

inits :: IntSet -> [IntSet] #

tails :: IntSet -> [IntSet] #

foldl :: (a -> IntSet -> a) -> a -> IntSet -> a #

foldl' :: (a -> IntSet -> a) -> a -> IntSet -> a #

foldr :: (IntSet -> a -> a) -> a -> IntSet -> a #

length :: IntSet -> Int #

foldMap :: Monoid n => (IntSet -> n) -> IntSet -> n #

span :: (IntSet -> Bool) -> IntSet -> (IntSet, IntSet) #

break :: (IntSet -> Bool) -> IntSet -> (IntSet, IntSet) #

split :: (IntSet -> Bool) -> IntSet -> [IntSet] #

takeWhile :: (IntSet -> Bool) -> IntSet -> IntSet #

dropWhile :: (IntSet -> Bool) -> IntSet -> IntSet #

spanMaybe :: s -> (s -> IntSet -> Maybe s) -> IntSet -> (IntSet, IntSet, s) #

spanMaybe' :: s -> (s -> IntSet -> Maybe s) -> IntSet -> (IntSet, IntSet, s) #

splitAt :: Int -> IntSet -> (IntSet, IntSet) #

drop :: Int -> IntSet -> IntSet #

take :: Int -> IntSet -> IntSet #

reverse :: IntSet -> IntSet #

FactorialMonoid Text # 

Methods

factors :: Text -> [Text] #

primePrefix :: Text -> Text #

primeSuffix :: Text -> Text #

splitPrimePrefix :: Text -> Maybe (Text, Text) #

splitPrimeSuffix :: Text -> Maybe (Text, Text) #

inits :: Text -> [Text] #

tails :: Text -> [Text] #

foldl :: (a -> Text -> a) -> a -> Text -> a #

foldl' :: (a -> Text -> a) -> a -> Text -> a #

foldr :: (Text -> a -> a) -> a -> Text -> a #

length :: Text -> Int #

foldMap :: Monoid n => (Text -> n) -> Text -> n #

span :: (Text -> Bool) -> Text -> (Text, Text) #

break :: (Text -> Bool) -> Text -> (Text, Text) #

split :: (Text -> Bool) -> Text -> [Text] #

takeWhile :: (Text -> Bool) -> Text -> Text #

dropWhile :: (Text -> Bool) -> Text -> Text #

spanMaybe :: s -> (s -> Text -> Maybe s) -> Text -> (Text, Text, s) #

spanMaybe' :: s -> (s -> Text -> Maybe s) -> Text -> (Text, Text, s) #

splitAt :: Int -> Text -> (Text, Text) #

drop :: Int -> Text -> Text #

take :: Int -> Text -> Text #

reverse :: Text -> Text #

FactorialMonoid Text # 

Methods

factors :: Text -> [Text] #

primePrefix :: Text -> Text #

primeSuffix :: Text -> Text #

splitPrimePrefix :: Text -> Maybe (Text, Text) #

splitPrimeSuffix :: Text -> Maybe (Text, Text) #

inits :: Text -> [Text] #

tails :: Text -> [Text] #

foldl :: (a -> Text -> a) -> a -> Text -> a #

foldl' :: (a -> Text -> a) -> a -> Text -> a #

foldr :: (Text -> a -> a) -> a -> Text -> a #

length :: Text -> Int #

foldMap :: Monoid n => (Text -> n) -> Text -> n #

span :: (Text -> Bool) -> Text -> (Text, Text) #

break :: (Text -> Bool) -> Text -> (Text, Text) #

split :: (Text -> Bool) -> Text -> [Text] #

takeWhile :: (Text -> Bool) -> Text -> Text #

dropWhile :: (Text -> Bool) -> Text -> Text #

spanMaybe :: s -> (s -> Text -> Maybe s) -> Text -> (Text, Text, s) #

spanMaybe' :: s -> (s -> Text -> Maybe s) -> Text -> (Text, Text, s) #

splitAt :: Int -> Text -> (Text, Text) #

drop :: Int -> Text -> Text #

take :: Int -> Text -> Text #

reverse :: Text -> Text #

FactorialMonoid ByteStringUTF8 # 

Methods

factors :: ByteStringUTF8 -> [ByteStringUTF8] #

primePrefix :: ByteStringUTF8 -> ByteStringUTF8 #

primeSuffix :: ByteStringUTF8 -> ByteStringUTF8 #

splitPrimePrefix :: ByteStringUTF8 -> Maybe (ByteStringUTF8, ByteStringUTF8) #

splitPrimeSuffix :: ByteStringUTF8 -> Maybe (ByteStringUTF8, ByteStringUTF8) #

inits :: ByteStringUTF8 -> [ByteStringUTF8] #

tails :: ByteStringUTF8 -> [ByteStringUTF8] #

foldl :: (a -> ByteStringUTF8 -> a) -> a -> ByteStringUTF8 -> a #

foldl' :: (a -> ByteStringUTF8 -> a) -> a -> ByteStringUTF8 -> a #

foldr :: (ByteStringUTF8 -> a -> a) -> a -> ByteStringUTF8 -> a #

length :: ByteStringUTF8 -> Int #

foldMap :: Monoid n => (ByteStringUTF8 -> n) -> ByteStringUTF8 -> n #

span :: (ByteStringUTF8 -> Bool) -> ByteStringUTF8 -> (ByteStringUTF8, ByteStringUTF8) #

break :: (ByteStringUTF8 -> Bool) -> ByteStringUTF8 -> (ByteStringUTF8, ByteStringUTF8) #

split :: (ByteStringUTF8 -> Bool) -> ByteStringUTF8 -> [ByteStringUTF8] #

takeWhile :: (ByteStringUTF8 -> Bool) -> ByteStringUTF8 -> ByteStringUTF8 #

dropWhile :: (ByteStringUTF8 -> Bool) -> ByteStringUTF8 -> ByteStringUTF8 #

spanMaybe :: s -> (s -> ByteStringUTF8 -> Maybe s) -> ByteStringUTF8 -> (ByteStringUTF8, ByteStringUTF8, s) #

spanMaybe' :: s -> (s -> ByteStringUTF8 -> Maybe s) -> ByteStringUTF8 -> (ByteStringUTF8, ByteStringUTF8, s) #

splitAt :: Int -> ByteStringUTF8 -> (ByteStringUTF8, ByteStringUTF8) #

drop :: Int -> ByteStringUTF8 -> ByteStringUTF8 #

take :: Int -> ByteStringUTF8 -> ByteStringUTF8 #

reverse :: ByteStringUTF8 -> ByteStringUTF8 #

FactorialMonoid [x] # 

Methods

factors :: [x] -> [[x]] #

primePrefix :: [x] -> [x] #

primeSuffix :: [x] -> [x] #

splitPrimePrefix :: [x] -> Maybe ([x], [x]) #

splitPrimeSuffix :: [x] -> Maybe ([x], [x]) #

inits :: [x] -> [[x]] #

tails :: [x] -> [[x]] #

foldl :: (a -> [x] -> a) -> a -> [x] -> a #

foldl' :: (a -> [x] -> a) -> a -> [x] -> a #

foldr :: ([x] -> a -> a) -> a -> [x] -> a #

length :: [x] -> Int #

foldMap :: Monoid n => ([x] -> n) -> [x] -> n #

span :: ([x] -> Bool) -> [x] -> ([x], [x]) #

break :: ([x] -> Bool) -> [x] -> ([x], [x]) #

split :: ([x] -> Bool) -> [x] -> [[x]] #

takeWhile :: ([x] -> Bool) -> [x] -> [x] #

dropWhile :: ([x] -> Bool) -> [x] -> [x] #

spanMaybe :: s -> (s -> [x] -> Maybe s) -> [x] -> ([x], [x], s) #

spanMaybe' :: s -> (s -> [x] -> Maybe s) -> [x] -> ([x], [x], s) #

splitAt :: Int -> [x] -> ([x], [x]) #

drop :: Int -> [x] -> [x] #

take :: Int -> [x] -> [x] #

reverse :: [x] -> [x] #

FactorialMonoid a => FactorialMonoid (Maybe a) # 

Methods

factors :: Maybe a -> [Maybe a] #

primePrefix :: Maybe a -> Maybe a #

primeSuffix :: Maybe a -> Maybe a #

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

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

inits :: Maybe a -> [Maybe a] #

tails :: Maybe a -> [Maybe a] #

foldl :: (a -> Maybe a -> a) -> a -> Maybe a -> a #

foldl' :: (a -> Maybe a -> a) -> a -> Maybe a -> a #

foldr :: (Maybe a -> a -> a) -> a -> Maybe a -> a #

length :: Maybe a -> Int #

foldMap :: Monoid n => (Maybe a -> n) -> Maybe a -> n #

span :: (Maybe a -> Bool) -> Maybe a -> (Maybe a, Maybe a) #

break :: (Maybe a -> Bool) -> Maybe a -> (Maybe a, Maybe a) #

split :: (Maybe a -> Bool) -> Maybe a -> [Maybe a] #

takeWhile :: (Maybe a -> Bool) -> Maybe a -> Maybe a #

dropWhile :: (Maybe a -> Bool) -> Maybe a -> Maybe a #

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

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

splitAt :: Int -> Maybe a -> (Maybe a, Maybe a) #

drop :: Int -> Maybe a -> Maybe a #

take :: Int -> Maybe a -> Maybe a #

reverse :: Maybe a -> Maybe a #

FactorialMonoid a => FactorialMonoid (Dual a) # 

Methods

factors :: Dual a -> [Dual a] #

primePrefix :: Dual a -> Dual a #

primeSuffix :: Dual a -> Dual a #

splitPrimePrefix :: Dual a -> Maybe (Dual a, Dual a) #

splitPrimeSuffix :: Dual a -> Maybe (Dual a, Dual a) #

inits :: Dual a -> [Dual a] #

tails :: Dual a -> [Dual a] #

foldl :: (a -> Dual a -> a) -> a -> Dual a -> a #

foldl' :: (a -> Dual a -> a) -> a -> Dual a -> a #

foldr :: (Dual a -> a -> a) -> a -> Dual a -> a #

length :: Dual a -> Int #

foldMap :: Monoid n => (Dual a -> n) -> Dual a -> n #

span :: (Dual a -> Bool) -> Dual a -> (Dual a, Dual a) #

break :: (Dual a -> Bool) -> Dual a -> (Dual a, Dual a) #

split :: (Dual a -> Bool) -> Dual a -> [Dual a] #

takeWhile :: (Dual a -> Bool) -> Dual a -> Dual a #

dropWhile :: (Dual a -> Bool) -> Dual a -> Dual a #

spanMaybe :: s -> (s -> Dual a -> Maybe s) -> Dual a -> (Dual a, Dual a, s) #

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

splitAt :: Int -> Dual a -> (Dual a, Dual a) #

drop :: Int -> Dual a -> Dual a #

take :: Int -> Dual a -> Dual a #

reverse :: Dual a -> Dual a #

(Integral a, Eq a) => FactorialMonoid (Sum a) # 

Methods

factors :: Sum a -> [Sum a] #

primePrefix :: Sum a -> Sum a #

primeSuffix :: Sum a -> Sum a #

splitPrimePrefix :: Sum a -> Maybe (Sum a, Sum a) #

splitPrimeSuffix :: Sum a -> Maybe (Sum a, Sum a) #

inits :: Sum a -> [Sum a] #

tails :: Sum a -> [Sum a] #

foldl :: (a -> Sum a -> a) -> a -> Sum a -> a #

foldl' :: (a -> Sum a -> a) -> a -> Sum a -> a #

foldr :: (Sum a -> a -> a) -> a -> Sum a -> a #

length :: Sum a -> Int #

foldMap :: Monoid n => (Sum a -> n) -> Sum a -> n #

span :: (Sum a -> Bool) -> Sum a -> (Sum a, Sum a) #

break :: (Sum a -> Bool) -> Sum a -> (Sum a, Sum a) #

split :: (Sum a -> Bool) -> Sum a -> [Sum a] #

takeWhile :: (Sum a -> Bool) -> Sum a -> Sum a #

dropWhile :: (Sum a -> Bool) -> Sum a -> Sum a #

spanMaybe :: s -> (s -> Sum a -> Maybe s) -> Sum a -> (Sum a, Sum a, s) #

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

splitAt :: Int -> Sum a -> (Sum a, Sum a) #

drop :: Int -> Sum a -> Sum a #

take :: Int -> Sum a -> Sum a #

reverse :: Sum a -> Sum a #

Integral a => FactorialMonoid (Product a) # 

Methods

factors :: Product a -> [Product a] #

primePrefix :: Product a -> Product a #

primeSuffix :: Product a -> Product a #

splitPrimePrefix :: Product a -> Maybe (Product a, Product a) #

splitPrimeSuffix :: Product a -> Maybe (Product a, Product a) #

inits :: Product a -> [Product a] #

tails :: Product a -> [Product a] #

foldl :: (a -> Product a -> a) -> a -> Product a -> a #

foldl' :: (a -> Product a -> a) -> a -> Product a -> a #

foldr :: (Product a -> a -> a) -> a -> Product a -> a #

length :: Product a -> Int #

foldMap :: Monoid n => (Product a -> n) -> Product a -> n #

span :: (Product a -> Bool) -> Product a -> (Product a, Product a) #

break :: (Product a -> Bool) -> Product a -> (Product a, Product a) #

split :: (Product a -> Bool) -> Product a -> [Product a] #

takeWhile :: (Product a -> Bool) -> Product a -> Product a #

dropWhile :: (Product a -> Bool) -> Product a -> Product a #

spanMaybe :: s -> (s -> Product a -> Maybe s) -> Product a -> (Product a, Product a, s) #

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

splitAt :: Int -> Product a -> (Product a, Product a) #

drop :: Int -> Product a -> Product a #

take :: Int -> Product a -> Product a #

reverse :: Product a -> Product a #

FactorialMonoid (IntMap a) # 

Methods

factors :: IntMap a -> [IntMap a] #

primePrefix :: IntMap a -> IntMap a #

primeSuffix :: IntMap a -> IntMap a #

splitPrimePrefix :: IntMap a -> Maybe (IntMap a, IntMap a) #

splitPrimeSuffix :: IntMap a -> Maybe (IntMap a, IntMap a) #

inits :: IntMap a -> [IntMap a] #

tails :: IntMap a -> [IntMap a] #

foldl :: (a -> IntMap a -> a) -> a -> IntMap a -> a #

foldl' :: (a -> IntMap a -> a) -> a -> IntMap a -> a #

foldr :: (IntMap a -> a -> a) -> a -> IntMap a -> a #

length :: IntMap a -> Int #

foldMap :: Monoid n => (IntMap a -> n) -> IntMap a -> n #

span :: (IntMap a -> Bool) -> IntMap a -> (IntMap a, IntMap a) #

break :: (IntMap a -> Bool) -> IntMap a -> (IntMap a, IntMap a) #

split :: (IntMap a -> Bool) -> IntMap a -> [IntMap a] #

takeWhile :: (IntMap a -> Bool) -> IntMap a -> IntMap a #

dropWhile :: (IntMap a -> Bool) -> IntMap a -> IntMap a #

spanMaybe :: s -> (s -> IntMap a -> Maybe s) -> IntMap a -> (IntMap a, IntMap a, s) #

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

splitAt :: Int -> IntMap a -> (IntMap a, IntMap a) #

drop :: Int -> IntMap a -> IntMap a #

take :: Int -> IntMap a -> IntMap a #

reverse :: IntMap a -> IntMap a #

FactorialMonoid (Seq a) # 

Methods

factors :: Seq a -> [Seq a] #

primePrefix :: Seq a -> Seq a #

primeSuffix :: Seq a -> Seq a #

splitPrimePrefix :: Seq a -> Maybe (Seq a, Seq a) #

splitPrimeSuffix :: Seq a -> Maybe (Seq a, Seq a) #

inits :: Seq a -> [Seq a] #

tails :: Seq a -> [Seq a] #

foldl :: (a -> Seq a -> a) -> a -> Seq a -> a #

foldl' :: (a -> Seq a -> a) -> a -> Seq a -> a #

foldr :: (Seq a -> a -> a) -> a -> Seq a -> a #

length :: Seq a -> Int #

foldMap :: Monoid n => (Seq a -> n) -> Seq a -> n #

span :: (Seq a -> Bool) -> Seq a -> (Seq a, Seq a) #

break :: (Seq a -> Bool) -> Seq a -> (Seq a, Seq a) #

split :: (Seq a -> Bool) -> Seq a -> [Seq a] #

takeWhile :: (Seq a -> Bool) -> Seq a -> Seq a #

dropWhile :: (Seq a -> Bool) -> Seq a -> Seq a #

spanMaybe :: s -> (s -> Seq a -> Maybe s) -> Seq a -> (Seq a, Seq a, s) #

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

splitAt :: Int -> Seq a -> (Seq a, Seq a) #

drop :: Int -> Seq a -> Seq a #

take :: Int -> Seq a -> Seq a #

reverse :: Seq a -> Seq a #

Ord a => FactorialMonoid (Set a) # 

Methods

factors :: Set a -> [Set a] #

primePrefix :: Set a -> Set a #

primeSuffix :: Set a -> Set a #

splitPrimePrefix :: Set a -> Maybe (Set a, Set a) #

splitPrimeSuffix :: Set a -> Maybe (Set a, Set a) #

inits :: Set a -> [Set a] #

tails :: Set a -> [Set a] #

foldl :: (a -> Set a -> a) -> a -> Set a -> a #

foldl' :: (a -> Set a -> a) -> a -> Set a -> a #

foldr :: (Set a -> a -> a) -> a -> Set a -> a #

length :: Set a -> Int #

foldMap :: Monoid n => (Set a -> n) -> Set a -> n #

span :: (Set a -> Bool) -> Set a -> (Set a, Set a) #

break :: (Set a -> Bool) -> Set a -> (Set a, Set a) #

split :: (Set a -> Bool) -> Set a -> [Set a] #

takeWhile :: (Set a -> Bool) -> Set a -> Set a #

dropWhile :: (Set a -> Bool) -> Set a -> Set a #

spanMaybe :: s -> (s -> Set a -> Maybe s) -> Set a -> (Set a, Set a, s) #

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

splitAt :: Int -> Set a -> (Set a, Set a) #

drop :: Int -> Set a -> Set a #

take :: Int -> Set a -> Set a #

reverse :: Set a -> Set a #

FactorialMonoid (Vector a) # 

Methods

factors :: Vector a -> [Vector a] #

primePrefix :: Vector a -> Vector a #

primeSuffix :: Vector a -> Vector a #

splitPrimePrefix :: Vector a -> Maybe (Vector a, Vector a) #

splitPrimeSuffix :: Vector a -> Maybe (Vector a, Vector a) #

inits :: Vector a -> [Vector a] #

tails :: Vector a -> [Vector a] #

foldl :: (a -> Vector a -> a) -> a -> Vector a -> a #

foldl' :: (a -> Vector a -> a) -> a -> Vector a -> a #

foldr :: (Vector a -> a -> a) -> a -> Vector a -> a #

length :: Vector a -> Int #

foldMap :: Monoid n => (Vector a -> n) -> Vector a -> n #

span :: (Vector a -> Bool) -> Vector a -> (Vector a, Vector a) #

break :: (Vector a -> Bool) -> Vector a -> (Vector a, Vector a) #

split :: (Vector a -> Bool) -> Vector a -> [Vector a] #

takeWhile :: (Vector a -> Bool) -> Vector a -> Vector a #

dropWhile :: (Vector a -> Bool) -> Vector a -> Vector a #

spanMaybe :: s -> (s -> Vector a -> Maybe s) -> Vector a -> (Vector a, Vector a, s) #

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

splitAt :: Int -> Vector a -> (Vector a, Vector a) #

drop :: Int -> Vector a -> Vector a #

take :: Int -> Vector a -> Vector a #

reverse :: Vector a -> Vector 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 #

StableFactorialMonoid a => FactorialMonoid (Measured a) # 

Methods

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

primePrefix :: Measured a -> Measured a #

primeSuffix :: Measured a -> Measured a #

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

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

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

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

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

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

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

length :: Measured a -> Int #

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

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

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

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

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

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

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

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

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

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

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

reverse :: Measured a -> Measured a #

(StableFactorialMonoid m, TextualMonoid m) => FactorialMonoid (LinePositioned m) # 

Methods

factors :: LinePositioned m -> [LinePositioned m] #

primePrefix :: LinePositioned m -> LinePositioned m #

primeSuffix :: LinePositioned m -> LinePositioned m #

splitPrimePrefix :: LinePositioned m -> Maybe (LinePositioned m, LinePositioned m) #

splitPrimeSuffix :: LinePositioned m -> Maybe (LinePositioned m, LinePositioned m) #

inits :: LinePositioned m -> [LinePositioned m] #

tails :: LinePositioned m -> [LinePositioned m] #

foldl :: (a -> LinePositioned m -> a) -> a -> LinePositioned m -> a #

foldl' :: (a -> LinePositioned m -> a) -> a -> LinePositioned m -> a #

foldr :: (LinePositioned m -> a -> a) -> a -> LinePositioned m -> a #

length :: LinePositioned m -> Int #

foldMap :: Monoid n => (LinePositioned m -> n) -> LinePositioned m -> n #

span :: (LinePositioned m -> Bool) -> LinePositioned m -> (LinePositioned m, LinePositioned m) #

break :: (LinePositioned m -> Bool) -> LinePositioned m -> (LinePositioned m, LinePositioned m) #

split :: (LinePositioned m -> Bool) -> LinePositioned m -> [LinePositioned m] #

takeWhile :: (LinePositioned m -> Bool) -> LinePositioned m -> LinePositioned m #

dropWhile :: (LinePositioned m -> Bool) -> LinePositioned m -> LinePositioned m #

spanMaybe :: s -> (s -> LinePositioned m -> Maybe s) -> LinePositioned m -> (LinePositioned m, LinePositioned m, s) #

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

splitAt :: Int -> LinePositioned m -> (LinePositioned m, LinePositioned m) #

drop :: Int -> LinePositioned m -> LinePositioned m #

take :: Int -> LinePositioned m -> LinePositioned m #

reverse :: LinePositioned m -> LinePositioned m #

StableFactorialMonoid m => FactorialMonoid (OffsetPositioned m) # 

Methods

factors :: OffsetPositioned m -> [OffsetPositioned m] #

primePrefix :: OffsetPositioned m -> OffsetPositioned m #

primeSuffix :: OffsetPositioned m -> OffsetPositioned m #

splitPrimePrefix :: OffsetPositioned m -> Maybe (OffsetPositioned m, OffsetPositioned m) #

splitPrimeSuffix :: OffsetPositioned m -> Maybe (OffsetPositioned m, OffsetPositioned m) #

inits :: OffsetPositioned m -> [OffsetPositioned m] #

tails :: OffsetPositioned m -> [OffsetPositioned m] #

foldl :: (a -> OffsetPositioned m -> a) -> a -> OffsetPositioned m -> a #

foldl' :: (a -> OffsetPositioned m -> a) -> a -> OffsetPositioned m -> a #

foldr :: (OffsetPositioned m -> a -> a) -> a -> OffsetPositioned m -> a #

length :: OffsetPositioned m -> Int #

foldMap :: Monoid n => (OffsetPositioned m -> n) -> OffsetPositioned m -> n #

span :: (OffsetPositioned m -> Bool) -> OffsetPositioned m -> (OffsetPositioned m, OffsetPositioned m) #

break :: (OffsetPositioned m -> Bool) -> OffsetPositioned m -> (OffsetPositioned m, OffsetPositioned m) #

split :: (OffsetPositioned m -> Bool) -> OffsetPositioned m -> [OffsetPositioned m] #

takeWhile :: (OffsetPositioned m -> Bool) -> OffsetPositioned m -> OffsetPositioned m #

dropWhile :: (OffsetPositioned m -> Bool) -> OffsetPositioned m -> OffsetPositioned m #

spanMaybe :: s -> (s -> OffsetPositioned m -> Maybe s) -> OffsetPositioned m -> (OffsetPositioned m, OffsetPositioned m, s) #

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

splitAt :: Int -> OffsetPositioned m -> (OffsetPositioned m, OffsetPositioned m) #

drop :: Int -> OffsetPositioned m -> OffsetPositioned m #

take :: Int -> OffsetPositioned m -> OffsetPositioned m #

reverse :: OffsetPositioned m -> OffsetPositioned m #

(FactorialMonoid a, FactorialMonoid b) => FactorialMonoid (a, b) # 

Methods

factors :: (a, b) -> [(a, b)] #

primePrefix :: (a, b) -> (a, b) #

primeSuffix :: (a, b) -> (a, b) #

splitPrimePrefix :: (a, b) -> Maybe ((a, b), (a, b)) #

splitPrimeSuffix :: (a, b) -> Maybe ((a, b), (a, b)) #

inits :: (a, b) -> [(a, b)] #

tails :: (a, b) -> [(a, b)] #

foldl :: (a -> (a, b) -> a) -> a -> (a, b) -> a #

foldl' :: (a -> (a, b) -> a) -> a -> (a, b) -> a #

foldr :: ((a, b) -> a -> a) -> a -> (a, b) -> a #

length :: (a, b) -> Int #

foldMap :: Monoid n => ((a, b) -> n) -> (a, b) -> n #

span :: ((a, b) -> Bool) -> (a, b) -> ((a, b), (a, b)) #

break :: ((a, b) -> Bool) -> (a, b) -> ((a, b), (a, b)) #

split :: ((a, b) -> Bool) -> (a, b) -> [(a, b)] #

takeWhile :: ((a, b) -> Bool) -> (a, b) -> (a, b) #

dropWhile :: ((a, b) -> Bool) -> (a, b) -> (a, b) #

spanMaybe :: s -> (s -> (a, b) -> Maybe s) -> (a, b) -> ((a, b), (a, b), s) #

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

splitAt :: Int -> (a, b) -> ((a, b), (a, b)) #

drop :: Int -> (a, b) -> (a, b) #

take :: Int -> (a, b) -> (a, b) #

reverse :: (a, b) -> (a, b) #

Ord k => FactorialMonoid (Map k v) # 

Methods

factors :: Map k v -> [Map k v] #

primePrefix :: Map k v -> Map k v #

primeSuffix :: Map k v -> Map k v #

splitPrimePrefix :: Map k v -> Maybe (Map k v, Map k v) #

splitPrimeSuffix :: Map k v -> Maybe (Map k v, Map k v) #

inits :: Map k v -> [Map k v] #

tails :: Map k v -> [Map k v] #

foldl :: (a -> Map k v -> a) -> a -> Map k v -> a #

foldl' :: (a -> Map k v -> a) -> a -> Map k v -> a #

foldr :: (Map k v -> a -> a) -> a -> Map k v -> a #

length :: Map k v -> Int #

foldMap :: Monoid n => (Map k v -> n) -> Map k v -> n #

span :: (Map k v -> Bool) -> Map k v -> (Map k v, Map k v) #

break :: (Map k v -> Bool) -> Map k v -> (Map k v, Map k v) #

split :: (Map k v -> Bool) -> Map k v -> [Map k v] #

takeWhile :: (Map k v -> Bool) -> Map k v -> Map k v #

dropWhile :: (Map k v -> Bool) -> Map k v -> Map k v #

spanMaybe :: s -> (s -> Map k v -> Maybe s) -> Map k v -> (Map k v, Map k v, s) #

spanMaybe' :: s -> (s -> Map k v -> Maybe s) -> Map k v -> (Map k v, Map k v, s) #

splitAt :: Int -> Map k v -> (Map k v, Map k v) #

drop :: Int -> Map k v -> Map k v #

take :: Int -> Map k v -> Map k v #

reverse :: Map k v -> Map k v #

(FactorialMonoid a, FactorialMonoid b) => FactorialMonoid (Stateful a b) # 

Methods

factors :: Stateful a b -> [Stateful a b] #

primePrefix :: Stateful a b -> Stateful a b #

primeSuffix :: Stateful a b -> Stateful a b #

splitPrimePrefix :: Stateful a b -> Maybe (Stateful a b, Stateful a b) #

splitPrimeSuffix :: Stateful a b -> Maybe (Stateful a b, Stateful a b) #

inits :: Stateful a b -> [Stateful a b] #

tails :: Stateful a b -> [Stateful a b] #

foldl :: (a -> Stateful a b -> a) -> a -> Stateful a b -> a #

foldl' :: (a -> Stateful a b -> a) -> a -> Stateful a b -> a #

foldr :: (Stateful a b -> a -> a) -> a -> Stateful a b -> a #

length :: Stateful a b -> Int #

foldMap :: Monoid n => (Stateful a b -> n) -> Stateful a b -> n #

span :: (Stateful a b -> Bool) -> Stateful a b -> (Stateful a b, Stateful a b) #

break :: (Stateful a b -> Bool) -> Stateful a b -> (Stateful a b, Stateful a b) #

split :: (Stateful a b -> Bool) -> Stateful a b -> [Stateful a b] #

takeWhile :: (Stateful a b -> Bool) -> Stateful a b -> Stateful a b #

dropWhile :: (Stateful a b -> Bool) -> Stateful a b -> Stateful a b #

spanMaybe :: s -> (s -> Stateful a b -> Maybe s) -> Stateful a b -> (Stateful a b, Stateful a b, s) #

spanMaybe' :: s -> (s -> Stateful a b -> Maybe s) -> Stateful a b -> (Stateful a b, Stateful a b, s) #

splitAt :: Int -> Stateful a b -> (Stateful a b, Stateful a b) #

drop :: Int -> Stateful a b -> Stateful a b #

take :: Int -> Stateful a b -> Stateful a b #

reverse :: Stateful a b -> Stateful a b #

(FactorialMonoid a, FactorialMonoid b, FactorialMonoid c) => FactorialMonoid (a, b, c) # 

Methods

factors :: (a, b, c) -> [(a, b, c)] #

primePrefix :: (a, b, c) -> (a, b, c) #

primeSuffix :: (a, b, c) -> (a, b, c) #

splitPrimePrefix :: (a, b, c) -> Maybe ((a, b, c), (a, b, c)) #

splitPrimeSuffix :: (a, b, c) -> Maybe ((a, b, c), (a, b, c)) #

inits :: (a, b, c) -> [(a, b, c)] #

tails :: (a, b, c) -> [(a, b, c)] #

foldl :: (a -> (a, b, c) -> a) -> a -> (a, b, c) -> a #

foldl' :: (a -> (a, b, c) -> a) -> a -> (a, b, c) -> a #

foldr :: ((a, b, c) -> a -> a) -> a -> (a, b, c) -> a #

length :: (a, b, c) -> Int #

foldMap :: Monoid n => ((a, b, c) -> n) -> (a, b, c) -> n #

span :: ((a, b, c) -> Bool) -> (a, b, c) -> ((a, b, c), (a, b, c)) #

break :: ((a, b, c) -> Bool) -> (a, b, c) -> ((a, b, c), (a, b, c)) #

split :: ((a, b, c) -> Bool) -> (a, b, c) -> [(a, b, c)] #

takeWhile :: ((a, b, c) -> Bool) -> (a, b, c) -> (a, b, c) #

dropWhile :: ((a, b, c) -> Bool) -> (a, b, c) -> (a, b, c) #

spanMaybe :: s -> (s -> (a, b, c) -> Maybe s) -> (a, b, c) -> ((a, b, c), (a, b, c), s) #

spanMaybe' :: s -> (s -> (a, b, c) -> Maybe s) -> (a, b, c) -> ((a, b, c), (a, b, c), s) #

splitAt :: Int -> (a, b, c) -> ((a, b, c), (a, b, c)) #

drop :: Int -> (a, b, c) -> (a, b, c) #

take :: Int -> (a, b, c) -> (a, b, c) #

reverse :: (a, b, c) -> (a, b, c) #

(FactorialMonoid a, FactorialMonoid b, FactorialMonoid c, FactorialMonoid d) => FactorialMonoid (a, b, c, d) # 

Methods

factors :: (a, b, c, d) -> [(a, b, c, d)] #

primePrefix :: (a, b, c, d) -> (a, b, c, d) #

primeSuffix :: (a, b, c, d) -> (a, b, c, d) #

splitPrimePrefix :: (a, b, c, d) -> Maybe ((a, b, c, d), (a, b, c, d)) #

splitPrimeSuffix :: (a, b, c, d) -> Maybe ((a, b, c, d), (a, b, c, d)) #

inits :: (a, b, c, d) -> [(a, b, c, d)] #

tails :: (a, b, c, d) -> [(a, b, c, d)] #

foldl :: (a -> (a, b, c, d) -> a) -> a -> (a, b, c, d) -> a #

foldl' :: (a -> (a, b, c, d) -> a) -> a -> (a, b, c, d) -> a #

foldr :: ((a, b, c, d) -> a -> a) -> a -> (a, b, c, d) -> a #

length :: (a, b, c, d) -> Int #

foldMap :: Monoid n => ((a, b, c, d) -> n) -> (a, b, c, d) -> n #

span :: ((a, b, c, d) -> Bool) -> (a, b, c, d) -> ((a, b, c, d), (a, b, c, d)) #

break :: ((a, b, c, d) -> Bool) -> (a, b, c, d) -> ((a, b, c, d), (a, b, c, d)) #

split :: ((a, b, c, d) -> Bool) -> (a, b, c, d) -> [(a, b, c, d)] #

takeWhile :: ((a, b, c, d) -> Bool) -> (a, b, c, d) -> (a, b, c, d) #

dropWhile :: ((a, b, c, d) -> Bool) -> (a, b, c, d) -> (a, b, c, d) #

spanMaybe :: s -> (s -> (a, b, c, d) -> Maybe s) -> (a, b, c, d) -> ((a, b, c, d), (a, b, c, d), s) #

spanMaybe' :: s -> (s -> (a, b, c, d) -> Maybe s) -> (a, b, c, d) -> ((a, b, c, d), (a, b, c, d), s) #

splitAt :: Int -> (a, b, c, d) -> ((a, b, c, d), (a, b, c, d)) #

drop :: Int -> (a, b, c, d) -> (a, b, c, d) #

take :: Int -> (a, b, c, d) -> (a, b, c, d) #

reverse :: (a, b, c, d) -> (a, b, c, d) #

Monad function equivalents

mapM :: (FactorialMonoid a, Monoid b, Monad m) => (a -> m b) -> a -> m b #

A mapM equivalent.

mapM_ :: (FactorialMonoid a, Monad m) => (a -> m b) -> a -> m () #

A mapM_ equivalent.