Safe Haskell | Trustworthy |
---|---|
Language | Haskell2010 |
Data.Monoid.Factorial
Description
This module defines the FactorialMonoid
class and some of its instances.
Synopsis
- module Data.Semigroup.Factorial
- class (Factorial m, MonoidNull m) => FactorialMonoid m where
- splitPrimePrefix :: m -> Maybe (m, m)
- splitPrimeSuffix :: m -> Maybe (m, m)
- inits :: m -> [m]
- tails :: m -> [m]
- span :: (m -> Bool) -> m -> (m, m)
- break :: (m -> Bool) -> m -> (m, m)
- split :: (m -> Bool) -> m -> [m]
- takeWhile :: (m -> Bool) -> m -> m
- dropWhile :: (m -> Bool) -> m -> m
- spanMaybe :: s -> (s -> m -> Maybe s) -> m -> (m, m, s)
- spanMaybe' :: s -> (s -> m -> Maybe s) -> m -> (m, m, s)
- splitAt :: Int -> m -> (m, m)
- drop :: Int -> m -> m
- take :: Int -> m -> m
- type StableFactorialMonoid m = (StableFactorial m, FactorialMonoid m, PositiveMonoid m)
Documentation
module Data.Semigroup.Factorial
class (Factorial m, MonoidNull m) => FactorialMonoid m where #
Class of monoids that can be split into irreducible (i.e., atomic or prime) factors
in a unique way. Note that
mempty
is not considered a factor. 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 in addition to those of Factorial
:
null == List.null . 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 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 should implement splitPrimePrefix
for performance reasons, and other methods where
beneficial.
Minimal complete definition
Nothing
Methods
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
.
Returns the list of all prefixes of the argument, mempty
first.
Returns the list of all suffixes of the argument, mempty
last.
span :: (m -> Bool) -> m -> (m, m) #
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) #
Equivalent to drop
from Data.List.
Equivalent to take
from Data.List.
Instances
FactorialMonoid ByteString # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: ByteString -> Maybe (ByteString, ByteString) # splitPrimeSuffix :: ByteString -> Maybe (ByteString, ByteString) # inits :: ByteString -> [ByteString] # tails :: ByteString -> [ByteString] # span :: (ByteString -> Bool) -> ByteString -> (ByteString, ByteString) # break :: (ByteString -> Bool) -> ByteString -> (ByteString, ByteString) # split :: (ByteString -> Bool) -> ByteString -> [ByteString] # takeWhile :: (ByteString -> Bool) -> ByteString -> ByteString # dropWhile :: (ByteString -> Bool) -> ByteString -> ByteString # spanMaybe :: s -> (s -> ByteString -> Maybe s) -> ByteString -> (ByteString, ByteString, s) # spanMaybe' :: s -> (s -> ByteString -> Maybe s) -> ByteString -> (ByteString, ByteString, s) # splitAt :: Int -> ByteString -> (ByteString, ByteString) # | |
FactorialMonoid ByteString # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: ByteString -> Maybe (ByteString, ByteString) # splitPrimeSuffix :: ByteString -> Maybe (ByteString, ByteString) # inits :: ByteString -> [ByteString] # tails :: ByteString -> [ByteString] # span :: (ByteString -> Bool) -> ByteString -> (ByteString, ByteString) # break :: (ByteString -> Bool) -> ByteString -> (ByteString, ByteString) # split :: (ByteString -> Bool) -> ByteString -> [ByteString] # takeWhile :: (ByteString -> Bool) -> ByteString -> ByteString # dropWhile :: (ByteString -> Bool) -> ByteString -> ByteString # spanMaybe :: s -> (s -> ByteString -> Maybe s) -> ByteString -> (ByteString, ByteString, s) # spanMaybe' :: s -> (s -> ByteString -> Maybe s) -> ByteString -> (ByteString, ByteString, s) # splitAt :: Int -> ByteString -> (ByteString, ByteString) # | |
FactorialMonoid IntSet # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: IntSet -> Maybe (IntSet, IntSet) # splitPrimeSuffix :: IntSet -> Maybe (IntSet, IntSet) # 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) # | |
FactorialMonoid ByteStringUTF8 # | |
Defined in Data.Monoid.Instances.ByteString.UTF8 Methods splitPrimePrefix :: ByteStringUTF8 -> Maybe (ByteStringUTF8, ByteStringUTF8) # splitPrimeSuffix :: ByteStringUTF8 -> Maybe (ByteStringUTF8, ByteStringUTF8) # inits :: ByteStringUTF8 -> [ByteStringUTF8] # tails :: ByteStringUTF8 -> [ByteStringUTF8] # 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 # | |
FactorialMonoid Text # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: Text -> Maybe (Text, Text) # splitPrimeSuffix :: Text -> Maybe (Text, Text) # 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) # | |
FactorialMonoid Text # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: Text -> Maybe (Text, Text) # splitPrimeSuffix :: Text -> Maybe (Text, Text) # 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) # | |
FactorialMonoid () # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: () -> Maybe ((), ()) # splitPrimeSuffix :: () -> Maybe ((), ()) # span :: (() -> Bool) -> () -> ((), ()) # break :: (() -> Bool) -> () -> ((), ()) # split :: (() -> Bool) -> () -> [()] # takeWhile :: (() -> Bool) -> () -> () # dropWhile :: (() -> Bool) -> () -> () # spanMaybe :: s -> (s -> () -> Maybe s) -> () -> ((), (), s) # spanMaybe' :: s -> (s -> () -> Maybe s) -> () -> ((), (), s) # | |
FactorialMonoid a => FactorialMonoid (Dual a) # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: Dual a -> Maybe (Dual a, Dual a) # splitPrimeSuffix :: Dual a -> Maybe (Dual a, Dual a) # 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) # | |
Integral a => FactorialMonoid (Product a) # | |
Defined in Data.Monoid.Factorial Methods 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] # 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) # | |
(Integral a, Eq a) => FactorialMonoid (Sum a) # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: Sum a -> Maybe (Sum a, Sum a) # splitPrimeSuffix :: Sum a -> Maybe (Sum a, Sum a) # 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) # | |
FactorialMonoid (IntMap a) # | |
Defined in Data.Monoid.Factorial Methods 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] # 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) # | |
FactorialMonoid (Seq a) # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: Seq a -> Maybe (Seq a, Seq a) # splitPrimeSuffix :: Seq a -> Maybe (Seq a, Seq a) # 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) # | |
Ord a => FactorialMonoid (Set a) # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: Set a -> Maybe (Set a, Set a) # splitPrimeSuffix :: Set a -> Maybe (Set a, Set a) # 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) # | |
(FactorialMonoid a, PositiveMonoid a) => FactorialMonoid (Concat a) # | |
Defined in Data.Monoid.Instances.Concat Methods 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] # 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) # | |
(StableFactorial a, FactorialMonoid a) => FactorialMonoid (Measured a) # | |
Defined in Data.Monoid.Instances.Measured Methods 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] # 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) # | |
(StableFactorial m, TextualMonoid m) => FactorialMonoid (LinePositioned m) # | |
Defined in Data.Monoid.Instances.Positioned Methods 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] # 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 # | |
(StableFactorial m, FactorialMonoid m) => FactorialMonoid (OffsetPositioned m) # | |
Defined in Data.Monoid.Instances.Positioned Methods 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] # 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 # | |
(StableFactorial m, FactorialMonoid m) => FactorialMonoid (Shadowed m) # | |
Defined in Data.Monoid.Instances.PrefixMemory Methods splitPrimePrefix :: Shadowed m -> Maybe (Shadowed m, Shadowed m) # splitPrimeSuffix :: Shadowed m -> Maybe (Shadowed m, Shadowed m) # inits :: Shadowed m -> [Shadowed m] # tails :: Shadowed m -> [Shadowed m] # span :: (Shadowed m -> Bool) -> Shadowed m -> (Shadowed m, Shadowed m) # break :: (Shadowed m -> Bool) -> Shadowed m -> (Shadowed m, Shadowed m) # split :: (Shadowed m -> Bool) -> Shadowed m -> [Shadowed m] # takeWhile :: (Shadowed m -> Bool) -> Shadowed m -> Shadowed m # dropWhile :: (Shadowed m -> Bool) -> Shadowed m -> Shadowed m # spanMaybe :: s -> (s -> Shadowed m -> Maybe s) -> Shadowed m -> (Shadowed m, Shadowed m, s) # spanMaybe' :: s -> (s -> Shadowed m -> Maybe s) -> Shadowed m -> (Shadowed m, Shadowed m, s) # splitAt :: Int -> Shadowed m -> (Shadowed m, Shadowed m) # | |
FactorialMonoid (Vector a) # | |
Defined in Data.Monoid.Factorial Methods 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] # 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) # | |
FactorialMonoid a => FactorialMonoid (Maybe a) # | |
Defined in Data.Monoid.Factorial Methods 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] # 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) # | |
FactorialMonoid [x] # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: [x] -> Maybe ([x], [x]) # splitPrimeSuffix :: [x] -> Maybe ([x], [x]) # 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) # | |
Ord k => FactorialMonoid (Map k v) # | |
Defined in Data.Monoid.Factorial Methods 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] # 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) # | |
(FactorialMonoid a, FactorialMonoid b) => FactorialMonoid (Stateful a b) # | |
Defined in Data.Monoid.Instances.Stateful Methods 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] # 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) # | |
(FactorialMonoid a, FactorialMonoid b) => FactorialMonoid (a, b) # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: (a, b) -> Maybe ((a, b), (a, b)) # splitPrimeSuffix :: (a, b) -> Maybe ((a, b), (a, b)) # 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)) # | |
(FactorialMonoid a, FactorialMonoid b, FactorialMonoid c) => FactorialMonoid (a, b, c) # | |
Defined in Data.Monoid.Factorial Methods 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)] # 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)) # | |
(FactorialMonoid a, FactorialMonoid b, FactorialMonoid c, FactorialMonoid d) => FactorialMonoid (a, b, c, d) # | |
Defined in Data.Monoid.Factorial Methods 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)] # 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)) # |
type StableFactorialMonoid m = (StableFactorial m, FactorialMonoid m, PositiveMonoid m) #
Deprecated: Use Data.Semigroup.Factorial.StableFactorial instead.