| 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 Source #
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 <> suffixA minimal instance definition should implement splitPrimePrefix for performance reasons, and other methods where
beneficial.
Minimal complete definition
Nothing
Methods
splitPrimePrefix :: m -> Maybe (m, m) Source #
Splits the argument into its prime prefix and the remaining suffix. Returns Nothing for mempty.
splitPrimeSuffix :: m -> Maybe (m, m) Source #
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) Source #
break :: (m -> Bool) -> m -> (m, m) Source #
split :: (m -> Bool) -> m -> [m] Source #
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 Source #
dropWhile :: (m -> Bool) -> m -> m Source #
spanMaybe :: s -> (s -> m -> Maybe s) -> m -> (m, m, s) Source #
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) Source #
Strict version of spanMaybe.
splitAt :: Int -> m -> (m, m) Source #
Instances
| FactorialMonoid ByteString Source # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: ByteString -> Maybe (ByteString, ByteString) Source # splitPrimeSuffix :: ByteString -> Maybe (ByteString, ByteString) Source # inits :: ByteString -> [ByteString] Source # tails :: ByteString -> [ByteString] Source # span :: (ByteString -> Bool) -> ByteString -> (ByteString, ByteString) Source # break :: (ByteString -> Bool) -> ByteString -> (ByteString, ByteString) Source # split :: (ByteString -> Bool) -> ByteString -> [ByteString] Source # takeWhile :: (ByteString -> Bool) -> ByteString -> ByteString Source # dropWhile :: (ByteString -> Bool) -> ByteString -> ByteString Source # spanMaybe :: s -> (s -> ByteString -> Maybe s) -> ByteString -> (ByteString, ByteString, s) Source # spanMaybe' :: s -> (s -> ByteString -> Maybe s) -> ByteString -> (ByteString, ByteString, s) Source # splitAt :: Int -> ByteString -> (ByteString, ByteString) Source # | |
| FactorialMonoid ByteString Source # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: ByteString -> Maybe (ByteString, ByteString) Source # splitPrimeSuffix :: ByteString -> Maybe (ByteString, ByteString) Source # inits :: ByteString -> [ByteString] Source # tails :: ByteString -> [ByteString] Source # span :: (ByteString -> Bool) -> ByteString -> (ByteString, ByteString) Source # break :: (ByteString -> Bool) -> ByteString -> (ByteString, ByteString) Source # split :: (ByteString -> Bool) -> ByteString -> [ByteString] Source # takeWhile :: (ByteString -> Bool) -> ByteString -> ByteString Source # dropWhile :: (ByteString -> Bool) -> ByteString -> ByteString Source # spanMaybe :: s -> (s -> ByteString -> Maybe s) -> ByteString -> (ByteString, ByteString, s) Source # spanMaybe' :: s -> (s -> ByteString -> Maybe s) -> ByteString -> (ByteString, ByteString, s) Source # splitAt :: Int -> ByteString -> (ByteString, ByteString) Source # | |
| FactorialMonoid IntSet Source # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: IntSet -> Maybe (IntSet, IntSet) Source # splitPrimeSuffix :: IntSet -> Maybe (IntSet, IntSet) Source # inits :: IntSet -> [IntSet] Source # tails :: IntSet -> [IntSet] Source # span :: (IntSet -> Bool) -> IntSet -> (IntSet, IntSet) Source # break :: (IntSet -> Bool) -> IntSet -> (IntSet, IntSet) Source # split :: (IntSet -> Bool) -> IntSet -> [IntSet] Source # takeWhile :: (IntSet -> Bool) -> IntSet -> IntSet Source # dropWhile :: (IntSet -> Bool) -> IntSet -> IntSet Source # spanMaybe :: s -> (s -> IntSet -> Maybe s) -> IntSet -> (IntSet, IntSet, s) Source # spanMaybe' :: s -> (s -> IntSet -> Maybe s) -> IntSet -> (IntSet, IntSet, s) Source # splitAt :: Int -> IntSet -> (IntSet, IntSet) Source # | |
| FactorialMonoid ByteStringUTF8 Source # | |
Defined in Data.Monoid.Instances.ByteString.UTF8 Methods splitPrimePrefix :: ByteStringUTF8 -> Maybe (ByteStringUTF8, ByteStringUTF8) Source # splitPrimeSuffix :: ByteStringUTF8 -> Maybe (ByteStringUTF8, ByteStringUTF8) Source # inits :: ByteStringUTF8 -> [ByteStringUTF8] Source # tails :: ByteStringUTF8 -> [ByteStringUTF8] Source # span :: (ByteStringUTF8 -> Bool) -> ByteStringUTF8 -> (ByteStringUTF8, ByteStringUTF8) Source # break :: (ByteStringUTF8 -> Bool) -> ByteStringUTF8 -> (ByteStringUTF8, ByteStringUTF8) Source # split :: (ByteStringUTF8 -> Bool) -> ByteStringUTF8 -> [ByteStringUTF8] Source # takeWhile :: (ByteStringUTF8 -> Bool) -> ByteStringUTF8 -> ByteStringUTF8 Source # dropWhile :: (ByteStringUTF8 -> Bool) -> ByteStringUTF8 -> ByteStringUTF8 Source # spanMaybe :: s -> (s -> ByteStringUTF8 -> Maybe s) -> ByteStringUTF8 -> (ByteStringUTF8, ByteStringUTF8, s) Source # spanMaybe' :: s -> (s -> ByteStringUTF8 -> Maybe s) -> ByteStringUTF8 -> (ByteStringUTF8, ByteStringUTF8, s) Source # splitAt :: Int -> ByteStringUTF8 -> (ByteStringUTF8, ByteStringUTF8) Source # drop :: Int -> ByteStringUTF8 -> ByteStringUTF8 Source # take :: Int -> ByteStringUTF8 -> ByteStringUTF8 Source # | |
| FactorialMonoid Text Source # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: Text -> Maybe (Text, Text) Source # splitPrimeSuffix :: Text -> Maybe (Text, Text) Source # inits :: Text -> [Text] Source # tails :: Text -> [Text] Source # span :: (Text -> Bool) -> Text -> (Text, Text) Source # break :: (Text -> Bool) -> Text -> (Text, Text) Source # split :: (Text -> Bool) -> Text -> [Text] Source # takeWhile :: (Text -> Bool) -> Text -> Text Source # dropWhile :: (Text -> Bool) -> Text -> Text Source # spanMaybe :: s -> (s -> Text -> Maybe s) -> Text -> (Text, Text, s) Source # spanMaybe' :: s -> (s -> Text -> Maybe s) -> Text -> (Text, Text, s) Source # splitAt :: Int -> Text -> (Text, Text) Source # | |
| FactorialMonoid Text Source # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: Text -> Maybe (Text, Text) Source # splitPrimeSuffix :: Text -> Maybe (Text, Text) Source # inits :: Text -> [Text] Source # tails :: Text -> [Text] Source # span :: (Text -> Bool) -> Text -> (Text, Text) Source # break :: (Text -> Bool) -> Text -> (Text, Text) Source # split :: (Text -> Bool) -> Text -> [Text] Source # takeWhile :: (Text -> Bool) -> Text -> Text Source # dropWhile :: (Text -> Bool) -> Text -> Text Source # spanMaybe :: s -> (s -> Text -> Maybe s) -> Text -> (Text, Text, s) Source # spanMaybe' :: s -> (s -> Text -> Maybe s) -> Text -> (Text, Text, s) Source # splitAt :: Int -> Text -> (Text, Text) Source # | |
| FactorialMonoid () Source # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: () -> Maybe ((), ()) Source # splitPrimeSuffix :: () -> Maybe ((), ()) Source # span :: (() -> Bool) -> () -> ((), ()) Source # break :: (() -> Bool) -> () -> ((), ()) Source # split :: (() -> Bool) -> () -> [()] Source # takeWhile :: (() -> Bool) -> () -> () Source # dropWhile :: (() -> Bool) -> () -> () Source # spanMaybe :: s -> (s -> () -> Maybe s) -> () -> ((), (), s) Source # spanMaybe' :: s -> (s -> () -> Maybe s) -> () -> ((), (), s) Source # splitAt :: Int -> () -> ((), ()) Source # | |
| FactorialMonoid (IntMap a) Source # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: IntMap a -> Maybe (IntMap a, IntMap a) Source # splitPrimeSuffix :: IntMap a -> Maybe (IntMap a, IntMap a) Source # inits :: IntMap a -> [IntMap a] Source # tails :: IntMap a -> [IntMap a] Source # span :: (IntMap a -> Bool) -> IntMap a -> (IntMap a, IntMap a) Source # break :: (IntMap a -> Bool) -> IntMap a -> (IntMap a, IntMap a) Source # split :: (IntMap a -> Bool) -> IntMap a -> [IntMap a] Source # takeWhile :: (IntMap a -> Bool) -> IntMap a -> IntMap a Source # dropWhile :: (IntMap a -> Bool) -> IntMap a -> IntMap a Source # spanMaybe :: s -> (s -> IntMap a -> Maybe s) -> IntMap a -> (IntMap a, IntMap a, s) Source # spanMaybe' :: s -> (s -> IntMap a -> Maybe s) -> IntMap a -> (IntMap a, IntMap a, s) Source # splitAt :: Int -> IntMap a -> (IntMap a, IntMap a) Source # | |
| FactorialMonoid (Seq a) Source # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: Seq a -> Maybe (Seq a, Seq a) Source # splitPrimeSuffix :: Seq a -> Maybe (Seq a, Seq a) Source # inits :: Seq a -> [Seq a] Source # tails :: Seq a -> [Seq a] Source # span :: (Seq a -> Bool) -> Seq a -> (Seq a, Seq a) Source # break :: (Seq a -> Bool) -> Seq a -> (Seq a, Seq a) Source # split :: (Seq a -> Bool) -> Seq a -> [Seq a] Source # takeWhile :: (Seq a -> Bool) -> Seq a -> Seq a Source # dropWhile :: (Seq a -> Bool) -> Seq a -> Seq a Source # spanMaybe :: s -> (s -> Seq a -> Maybe s) -> Seq a -> (Seq a, Seq a, s) Source # spanMaybe' :: s -> (s -> Seq a -> Maybe s) -> Seq a -> (Seq a, Seq a, s) Source # splitAt :: Int -> Seq a -> (Seq a, Seq a) Source # | |
| Ord a => FactorialMonoid (Set a) Source # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: Set a -> Maybe (Set a, Set a) Source # splitPrimeSuffix :: Set a -> Maybe (Set a, Set a) Source # inits :: Set a -> [Set a] Source # tails :: Set a -> [Set a] Source # span :: (Set a -> Bool) -> Set a -> (Set a, Set a) Source # break :: (Set a -> Bool) -> Set a -> (Set a, Set a) Source # split :: (Set a -> Bool) -> Set a -> [Set a] Source # takeWhile :: (Set a -> Bool) -> Set a -> Set a Source # dropWhile :: (Set a -> Bool) -> Set a -> Set a Source # spanMaybe :: s -> (s -> Set a -> Maybe s) -> Set a -> (Set a, Set a, s) Source # spanMaybe' :: s -> (s -> Set a -> Maybe s) -> Set a -> (Set a, Set a, s) Source # splitAt :: Int -> Set a -> (Set a, Set a) Source # | |
| FactorialMonoid a => FactorialMonoid (Identity a) Source # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: Identity a -> Maybe (Identity a, Identity a) Source # splitPrimeSuffix :: Identity a -> Maybe (Identity a, Identity a) Source # inits :: Identity a -> [Identity a] Source # tails :: Identity a -> [Identity a] Source # span :: (Identity a -> Bool) -> Identity a -> (Identity a, Identity a) Source # break :: (Identity a -> Bool) -> Identity a -> (Identity a, Identity a) Source # split :: (Identity a -> Bool) -> Identity a -> [Identity a] Source # takeWhile :: (Identity a -> Bool) -> Identity a -> Identity a Source # dropWhile :: (Identity a -> Bool) -> Identity a -> Identity a Source # spanMaybe :: s -> (s -> Identity a -> Maybe s) -> Identity a -> (Identity a, Identity a, s) Source # spanMaybe' :: s -> (s -> Identity a -> Maybe s) -> Identity a -> (Identity a, Identity a, s) Source # splitAt :: Int -> Identity a -> (Identity a, Identity a) Source # | |
| FactorialMonoid a => FactorialMonoid (Dual a) Source # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: Dual a -> Maybe (Dual a, Dual a) Source # splitPrimeSuffix :: Dual a -> Maybe (Dual a, Dual a) Source # inits :: Dual a -> [Dual a] Source # tails :: Dual a -> [Dual a] Source # span :: (Dual a -> Bool) -> Dual a -> (Dual a, Dual a) Source # break :: (Dual a -> Bool) -> Dual a -> (Dual a, Dual a) Source # split :: (Dual a -> Bool) -> Dual a -> [Dual a] Source # takeWhile :: (Dual a -> Bool) -> Dual a -> Dual a Source # dropWhile :: (Dual a -> Bool) -> Dual a -> Dual a Source # spanMaybe :: s -> (s -> Dual a -> Maybe s) -> Dual a -> (Dual a, Dual a, s) Source # spanMaybe' :: s -> (s -> Dual a -> Maybe s) -> Dual a -> (Dual a, Dual a, s) Source # splitAt :: Int -> Dual a -> (Dual a, Dual a) Source # | |
| Integral a => FactorialMonoid (Product a) Source # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: Product a -> Maybe (Product a, Product a) Source # splitPrimeSuffix :: Product a -> Maybe (Product a, Product a) Source # inits :: Product a -> [Product a] Source # tails :: Product a -> [Product a] Source # span :: (Product a -> Bool) -> Product a -> (Product a, Product a) Source # break :: (Product a -> Bool) -> Product a -> (Product a, Product a) Source # split :: (Product a -> Bool) -> Product a -> [Product a] Source # takeWhile :: (Product a -> Bool) -> Product a -> Product a Source # dropWhile :: (Product a -> Bool) -> Product a -> Product a Source # spanMaybe :: s -> (s -> Product a -> Maybe s) -> Product a -> (Product a, Product a, s) Source # spanMaybe' :: s -> (s -> Product a -> Maybe s) -> Product a -> (Product a, Product a, s) Source # splitAt :: Int -> Product a -> (Product a, Product a) Source # | |
| (Integral a, Eq a) => FactorialMonoid (Sum a) Source # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: Sum a -> Maybe (Sum a, Sum a) Source # splitPrimeSuffix :: Sum a -> Maybe (Sum a, Sum a) Source # inits :: Sum a -> [Sum a] Source # tails :: Sum a -> [Sum a] Source # span :: (Sum a -> Bool) -> Sum a -> (Sum a, Sum a) Source # break :: (Sum a -> Bool) -> Sum a -> (Sum a, Sum a) Source # split :: (Sum a -> Bool) -> Sum a -> [Sum a] Source # takeWhile :: (Sum a -> Bool) -> Sum a -> Sum a Source # dropWhile :: (Sum a -> Bool) -> Sum a -> Sum a Source # spanMaybe :: s -> (s -> Sum a -> Maybe s) -> Sum a -> (Sum a, Sum a, s) Source # spanMaybe' :: s -> (s -> Sum a -> Maybe s) -> Sum a -> (Sum a, Sum a, s) Source # splitAt :: Int -> Sum a -> (Sum a, Sum a) Source # | |
| (FactorialMonoid a, PositiveMonoid a) => FactorialMonoid (Concat a) Source # | |
Defined in Data.Monoid.Instances.Concat Methods splitPrimePrefix :: Concat a -> Maybe (Concat a, Concat a) Source # splitPrimeSuffix :: Concat a -> Maybe (Concat a, Concat a) Source # inits :: Concat a -> [Concat a] Source # tails :: Concat a -> [Concat a] Source # span :: (Concat a -> Bool) -> Concat a -> (Concat a, Concat a) Source # break :: (Concat a -> Bool) -> Concat a -> (Concat a, Concat a) Source # split :: (Concat a -> Bool) -> Concat a -> [Concat a] Source # takeWhile :: (Concat a -> Bool) -> Concat a -> Concat a Source # dropWhile :: (Concat a -> Bool) -> Concat a -> Concat a Source # spanMaybe :: s -> (s -> Concat a -> Maybe s) -> Concat a -> (Concat a, Concat a, s) Source # spanMaybe' :: s -> (s -> Concat a -> Maybe s) -> Concat a -> (Concat a, Concat a, s) Source # splitAt :: Int -> Concat a -> (Concat a, Concat a) Source # | |
| (StableFactorial a, FactorialMonoid a) => FactorialMonoid (Measured a) Source # | |
Defined in Data.Monoid.Instances.Measured Methods 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 # 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 # | |
| (StableFactorial m, TextualMonoid m) => FactorialMonoid (LinePositioned m) Source # | |
Defined in Data.Monoid.Instances.Positioned Methods splitPrimePrefix :: LinePositioned m -> Maybe (LinePositioned m, LinePositioned m) Source # splitPrimeSuffix :: LinePositioned m -> Maybe (LinePositioned m, LinePositioned m) Source # inits :: LinePositioned m -> [LinePositioned m] Source # tails :: LinePositioned m -> [LinePositioned m] Source # span :: (LinePositioned m -> Bool) -> LinePositioned m -> (LinePositioned m, LinePositioned m) Source # break :: (LinePositioned m -> Bool) -> LinePositioned m -> (LinePositioned m, LinePositioned m) Source # split :: (LinePositioned m -> Bool) -> LinePositioned m -> [LinePositioned m] Source # takeWhile :: (LinePositioned m -> Bool) -> LinePositioned m -> LinePositioned m Source # dropWhile :: (LinePositioned m -> Bool) -> LinePositioned m -> LinePositioned m Source # spanMaybe :: s -> (s -> LinePositioned m -> Maybe s) -> LinePositioned m -> (LinePositioned m, LinePositioned m, s) Source # spanMaybe' :: s -> (s -> LinePositioned m -> Maybe s) -> LinePositioned m -> (LinePositioned m, LinePositioned m, s) Source # splitAt :: Int -> LinePositioned m -> (LinePositioned m, LinePositioned m) Source # drop :: Int -> LinePositioned m -> LinePositioned m Source # take :: Int -> LinePositioned m -> LinePositioned m Source # | |
| (StableFactorial m, FactorialMonoid m) => FactorialMonoid (OffsetPositioned m) Source # | |
Defined in Data.Monoid.Instances.Positioned Methods splitPrimePrefix :: OffsetPositioned m -> Maybe (OffsetPositioned m, OffsetPositioned m) Source # splitPrimeSuffix :: OffsetPositioned m -> Maybe (OffsetPositioned m, OffsetPositioned m) Source # inits :: OffsetPositioned m -> [OffsetPositioned m] Source # tails :: OffsetPositioned m -> [OffsetPositioned m] Source # span :: (OffsetPositioned m -> Bool) -> OffsetPositioned m -> (OffsetPositioned m, OffsetPositioned m) Source # break :: (OffsetPositioned m -> Bool) -> OffsetPositioned m -> (OffsetPositioned m, OffsetPositioned m) Source # split :: (OffsetPositioned m -> Bool) -> OffsetPositioned m -> [OffsetPositioned m] Source # takeWhile :: (OffsetPositioned m -> Bool) -> OffsetPositioned m -> OffsetPositioned m Source # dropWhile :: (OffsetPositioned m -> Bool) -> OffsetPositioned m -> OffsetPositioned m Source # spanMaybe :: s -> (s -> OffsetPositioned m -> Maybe s) -> OffsetPositioned m -> (OffsetPositioned m, OffsetPositioned m, s) Source # spanMaybe' :: s -> (s -> OffsetPositioned m -> Maybe s) -> OffsetPositioned m -> (OffsetPositioned m, OffsetPositioned m, s) Source # splitAt :: Int -> OffsetPositioned m -> (OffsetPositioned m, OffsetPositioned m) Source # drop :: Int -> OffsetPositioned m -> OffsetPositioned m Source # take :: Int -> OffsetPositioned m -> OffsetPositioned m Source # | |
| (StableFactorial m, FactorialMonoid m) => FactorialMonoid (Shadowed m) Source # | |
Defined in Data.Monoid.Instances.PrefixMemory Methods splitPrimePrefix :: Shadowed m -> Maybe (Shadowed m, Shadowed m) Source # splitPrimeSuffix :: Shadowed m -> Maybe (Shadowed m, Shadowed m) Source # inits :: Shadowed m -> [Shadowed m] Source # tails :: Shadowed m -> [Shadowed m] Source # span :: (Shadowed m -> Bool) -> Shadowed m -> (Shadowed m, Shadowed m) Source # break :: (Shadowed m -> Bool) -> Shadowed m -> (Shadowed m, Shadowed m) Source # split :: (Shadowed m -> Bool) -> Shadowed m -> [Shadowed m] Source # takeWhile :: (Shadowed m -> Bool) -> Shadowed m -> Shadowed m Source # dropWhile :: (Shadowed m -> Bool) -> Shadowed m -> Shadowed m Source # spanMaybe :: s -> (s -> Shadowed m -> Maybe s) -> Shadowed m -> (Shadowed m, Shadowed m, s) Source # spanMaybe' :: s -> (s -> Shadowed m -> Maybe s) -> Shadowed m -> (Shadowed m, Shadowed m, s) Source # splitAt :: Int -> Shadowed m -> (Shadowed m, Shadowed m) Source # | |
| FactorialMonoid (Vector a) Source # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: Vector a -> Maybe (Vector a, Vector a) Source # splitPrimeSuffix :: Vector a -> Maybe (Vector a, Vector a) Source # inits :: Vector a -> [Vector a] Source # tails :: Vector a -> [Vector a] Source # span :: (Vector a -> Bool) -> Vector a -> (Vector a, Vector a) Source # break :: (Vector a -> Bool) -> Vector a -> (Vector a, Vector a) Source # split :: (Vector a -> Bool) -> Vector a -> [Vector a] Source # takeWhile :: (Vector a -> Bool) -> Vector a -> Vector a Source # dropWhile :: (Vector a -> Bool) -> Vector a -> Vector a Source # spanMaybe :: s -> (s -> Vector a -> Maybe s) -> Vector a -> (Vector a, Vector a, s) Source # spanMaybe' :: s -> (s -> Vector a -> Maybe s) -> Vector a -> (Vector a, Vector a, s) Source # splitAt :: Int -> Vector a -> (Vector a, Vector a) Source # | |
| FactorialMonoid a => FactorialMonoid (Maybe a) Source # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: Maybe a -> Maybe (Maybe a, Maybe a) Source # splitPrimeSuffix :: Maybe a -> Maybe (Maybe a, Maybe a) Source # inits :: Maybe a -> [Maybe a] Source # tails :: Maybe a -> [Maybe a] Source # span :: (Maybe a -> Bool) -> Maybe a -> (Maybe a, Maybe a) Source # break :: (Maybe a -> Bool) -> Maybe a -> (Maybe a, Maybe a) Source # split :: (Maybe a -> Bool) -> Maybe a -> [Maybe a] Source # takeWhile :: (Maybe a -> Bool) -> Maybe a -> Maybe a Source # dropWhile :: (Maybe a -> Bool) -> Maybe a -> Maybe a Source # spanMaybe :: s -> (s -> Maybe a -> Maybe s) -> Maybe a -> (Maybe a, Maybe a, s) Source # spanMaybe' :: s -> (s -> Maybe a -> Maybe s) -> Maybe a -> (Maybe a, Maybe a, s) Source # splitAt :: Int -> Maybe a -> (Maybe a, Maybe a) Source # | |
| FactorialMonoid [x] Source # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: [x] -> Maybe ([x], [x]) Source # splitPrimeSuffix :: [x] -> Maybe ([x], [x]) Source # inits :: [x] -> [[x]] Source # tails :: [x] -> [[x]] Source # span :: ([x] -> Bool) -> [x] -> ([x], [x]) Source # break :: ([x] -> Bool) -> [x] -> ([x], [x]) Source # split :: ([x] -> Bool) -> [x] -> [[x]] Source # takeWhile :: ([x] -> Bool) -> [x] -> [x] Source # dropWhile :: ([x] -> Bool) -> [x] -> [x] Source # spanMaybe :: s -> (s -> [x] -> Maybe s) -> [x] -> ([x], [x], s) Source # spanMaybe' :: s -> (s -> [x] -> Maybe s) -> [x] -> ([x], [x], s) Source # splitAt :: Int -> [x] -> ([x], [x]) Source # | |
| Ord k => FactorialMonoid (Map k v) Source # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: Map k v -> Maybe (Map k v, Map k v) Source # splitPrimeSuffix :: Map k v -> Maybe (Map k v, Map k v) Source # inits :: Map k v -> [Map k v] Source # tails :: Map k v -> [Map k v] Source # span :: (Map k v -> Bool) -> Map k v -> (Map k v, Map k v) Source # break :: (Map k v -> Bool) -> Map k v -> (Map k v, Map k v) Source # split :: (Map k v -> Bool) -> Map k v -> [Map k v] Source # takeWhile :: (Map k v -> Bool) -> Map k v -> Map k v Source # dropWhile :: (Map k v -> Bool) -> Map k v -> Map k v Source # spanMaybe :: s -> (s -> Map k v -> Maybe s) -> Map k v -> (Map k v, Map k v, s) Source # spanMaybe' :: s -> (s -> Map k v -> Maybe s) -> Map k v -> (Map k v, Map k v, s) Source # splitAt :: Int -> Map k v -> (Map k v, Map k v) Source # | |
| (FactorialMonoid a, FactorialMonoid b) => FactorialMonoid (Stateful a b) Source # | |
Defined in Data.Monoid.Instances.Stateful Methods splitPrimePrefix :: Stateful a b -> Maybe (Stateful a b, Stateful a b) Source # splitPrimeSuffix :: Stateful a b -> Maybe (Stateful a b, Stateful a b) Source # inits :: Stateful a b -> [Stateful a b] Source # tails :: Stateful a b -> [Stateful a b] Source # span :: (Stateful a b -> Bool) -> Stateful a b -> (Stateful a b, Stateful a b) Source # break :: (Stateful a b -> Bool) -> Stateful a b -> (Stateful a b, Stateful a b) Source # split :: (Stateful a b -> Bool) -> Stateful a b -> [Stateful a b] Source # takeWhile :: (Stateful a b -> Bool) -> Stateful a b -> Stateful a b Source # dropWhile :: (Stateful a b -> Bool) -> Stateful a b -> Stateful a b Source # spanMaybe :: s -> (s -> Stateful a b -> Maybe s) -> Stateful a b -> (Stateful a b, Stateful a b, s) Source # spanMaybe' :: s -> (s -> Stateful a b -> Maybe s) -> Stateful a b -> (Stateful a b, Stateful a b, s) Source # splitAt :: Int -> Stateful a b -> (Stateful a b, Stateful a b) Source # | |
| (FactorialMonoid a, FactorialMonoid b) => FactorialMonoid (a, b) Source # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: (a, b) -> Maybe ((a, b), (a, b)) Source # splitPrimeSuffix :: (a, b) -> Maybe ((a, b), (a, b)) Source # inits :: (a, b) -> [(a, b)] Source # tails :: (a, b) -> [(a, b)] Source # span :: ((a, b) -> Bool) -> (a, b) -> ((a, b), (a, b)) Source # break :: ((a, b) -> Bool) -> (a, b) -> ((a, b), (a, b)) Source # split :: ((a, b) -> Bool) -> (a, b) -> [(a, b)] Source # takeWhile :: ((a, b) -> Bool) -> (a, b) -> (a, b) Source # dropWhile :: ((a, b) -> Bool) -> (a, b) -> (a, b) Source # spanMaybe :: s -> (s -> (a, b) -> Maybe s) -> (a, b) -> ((a, b), (a, b), s) Source # spanMaybe' :: s -> (s -> (a, b) -> Maybe s) -> (a, b) -> ((a, b), (a, b), s) Source # splitAt :: Int -> (a, b) -> ((a, b), (a, b)) Source # | |
| FactorialMonoid a => FactorialMonoid (Const a b) Source # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: Const a b -> Maybe (Const a b, Const a b) Source # splitPrimeSuffix :: Const a b -> Maybe (Const a b, Const a b) Source # inits :: Const a b -> [Const a b] Source # tails :: Const a b -> [Const a b] Source # span :: (Const a b -> Bool) -> Const a b -> (Const a b, Const a b) Source # break :: (Const a b -> Bool) -> Const a b -> (Const a b, Const a b) Source # split :: (Const a b -> Bool) -> Const a b -> [Const a b] Source # takeWhile :: (Const a b -> Bool) -> Const a b -> Const a b Source # dropWhile :: (Const a b -> Bool) -> Const a b -> Const a b Source # spanMaybe :: s -> (s -> Const a b -> Maybe s) -> Const a b -> (Const a b, Const a b, s) Source # spanMaybe' :: s -> (s -> Const a b -> Maybe s) -> Const a b -> (Const a b, Const a b, s) Source # splitAt :: Int -> Const a b -> (Const a b, Const a b) Source # | |
| (FactorialMonoid a, FactorialMonoid b, FactorialMonoid c) => FactorialMonoid (a, b, c) Source # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: (a, b, c) -> Maybe ((a, b, c), (a, b, c)) Source # splitPrimeSuffix :: (a, b, c) -> Maybe ((a, b, c), (a, b, c)) Source # inits :: (a, b, c) -> [(a, b, c)] Source # tails :: (a, b, c) -> [(a, b, c)] Source # span :: ((a, b, c) -> Bool) -> (a, b, c) -> ((a, b, c), (a, b, c)) Source # break :: ((a, b, c) -> Bool) -> (a, b, c) -> ((a, b, c), (a, b, c)) Source # split :: ((a, b, c) -> Bool) -> (a, b, c) -> [(a, b, c)] Source # takeWhile :: ((a, b, c) -> Bool) -> (a, b, c) -> (a, b, c) Source # dropWhile :: ((a, b, c) -> Bool) -> (a, b, c) -> (a, b, c) Source # spanMaybe :: s -> (s -> (a, b, c) -> Maybe s) -> (a, b, c) -> ((a, b, c), (a, b, c), s) Source # spanMaybe' :: s -> (s -> (a, b, c) -> Maybe s) -> (a, b, c) -> ((a, b, c), (a, b, c), s) Source # splitAt :: Int -> (a, b, c) -> ((a, b, c), (a, b, c)) Source # | |
| (FactorialMonoid a, FactorialMonoid b, FactorialMonoid c, FactorialMonoid d) => FactorialMonoid (a, b, c, d) Source # | |
Defined in Data.Monoid.Factorial Methods splitPrimePrefix :: (a, b, c, d) -> Maybe ((a, b, c, d), (a, b, c, d)) Source # splitPrimeSuffix :: (a, b, c, d) -> Maybe ((a, b, c, d), (a, b, c, d)) Source # inits :: (a, b, c, d) -> [(a, b, c, d)] Source # tails :: (a, b, c, d) -> [(a, b, c, d)] Source # span :: ((a, b, c, d) -> Bool) -> (a, b, c, d) -> ((a, b, c, d), (a, b, c, d)) Source # break :: ((a, b, c, d) -> Bool) -> (a, b, c, d) -> ((a, b, c, d), (a, b, c, d)) Source # split :: ((a, b, c, d) -> Bool) -> (a, b, c, d) -> [(a, b, c, d)] Source # takeWhile :: ((a, b, c, d) -> Bool) -> (a, b, c, d) -> (a, b, c, d) Source # dropWhile :: ((a, b, c, d) -> Bool) -> (a, b, c, d) -> (a, b, c, d) Source # spanMaybe :: s -> (s -> (a, b, c, d) -> Maybe s) -> (a, b, c, d) -> ((a, b, c, d), (a, b, c, d), s) Source # spanMaybe' :: s -> (s -> (a, b, c, d) -> Maybe s) -> (a, b, c, d) -> ((a, b, c, d), (a, b, c, d), s) Source # splitAt :: Int -> (a, b, c, d) -> ((a, b, c, d), (a, b, c, d)) Source # | |
type StableFactorialMonoid m = (StableFactorial m, FactorialMonoid m, PositiveMonoid m) Source #
Deprecated: Use Data.Semigroup.Factorial.StableFactorial instead.