-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Subclasses of Monoid
--   
--   A hierarchy of subclasses of Monoid together with their
--   instances for all data structures from base, containers, and text
--   packages.
@package monoid-subclasses
@version 1.2.6

-- | This module defines the MonoidNull class and some of its instances.
module Data.Monoid.Null

-- | Extension of Monoid that allows testing a value for equality
--   with mempty. The following law must hold:
--   
--   
--   null x == (x == mempty)
--   
--   
--   Furthermore, the performance of this method should be constant,
--   i.e., independent of the length of its argument.
class Monoid m => MonoidNull m
null :: MonoidNull m => m -> Bool
($dmnull) :: (MonoidNull m, Eq m) => m -> Bool

-- | Subclass of Monoid for types whose values have no inverse, with
--   the exception of mempty. More formally, the class instances
--   must satisfy the following law:
--   
--   
--   null (x <> y) == (null x && null y)
--   
class MonoidNull m => PositiveMonoid m
instance (Data.Monoid.Null.MonoidNull (f p), Data.Monoid.Null.MonoidNull (g p)) => Data.Monoid.Null.MonoidNull ((GHC.Internal.Generics.:*:) f g p)
instance Data.Monoid.Null.MonoidNull (f (g p)) => Data.Monoid.Null.MonoidNull ((GHC.Internal.Generics.:.:) f g p)
instance Data.Monoid.Null.MonoidNull GHC.Internal.Data.Semigroup.Internal.All
instance Data.Monoid.Null.MonoidNull GHC.Internal.Data.Semigroup.Internal.Any
instance Data.Monoid.Null.MonoidNull Data.ByteString.Lazy.Internal.ByteString
instance Data.Monoid.Null.MonoidNull Data.ByteString.Internal.Type.ByteString
instance Data.Monoid.Null.MonoidNull (f (g a)) => Data.Monoid.Null.MonoidNull (Data.Functor.Compose.Compose f g a)
instance Data.Monoid.Null.MonoidNull a => Data.Monoid.Null.MonoidNull (GHC.Internal.Data.Functor.Const.Const a b)
instance Data.Monoid.Null.MonoidNull a => Data.Monoid.Null.MonoidNull (GHC.Internal.Data.Ord.Down a)
instance Data.Monoid.Null.MonoidNull a => Data.Monoid.Null.MonoidNull (GHC.Internal.Data.Semigroup.Internal.Dual a)
instance Data.Monoid.Null.MonoidNull (GHC.Internal.Data.Monoid.First a)
instance Data.Monoid.Null.MonoidNull a => Data.Monoid.Null.MonoidNull (GHC.Internal.Data.Functor.Identity.Identity a)
instance Data.Monoid.Null.MonoidNull (Data.IntMap.Internal.IntMap v)
instance Data.Monoid.Null.MonoidNull Data.IntSet.Internal.IntSet
instance Data.Monoid.Null.MonoidNull c => Data.Monoid.Null.MonoidNull (GHC.Internal.Generics.K1 i c p)
instance Data.Monoid.Null.MonoidNull (GHC.Internal.Data.Monoid.Last a)
instance Data.Monoid.Null.MonoidNull [x]
instance Data.Monoid.Null.MonoidNull (f p) => Data.Monoid.Null.MonoidNull (GHC.Internal.Generics.M1 i c f p)
instance GHC.Classes.Ord k => Data.Monoid.Null.MonoidNull (Data.Map.Internal.Map k v)
instance (GHC.Classes.Ord a, GHC.Internal.Enum.Bounded a) => Data.Monoid.Null.MonoidNull (Data.Semigroup.Max a)
instance GHC.Internal.Base.Monoid a => Data.Monoid.Null.MonoidNull (GHC.Internal.Maybe.Maybe a)
instance (GHC.Classes.Ord a, GHC.Internal.Enum.Bounded a) => Data.Monoid.Null.MonoidNull (Data.Semigroup.Min a)
instance Data.Monoid.Null.MonoidNull GHC.Types.Ordering
instance Data.Monoid.Null.MonoidNull p => Data.Monoid.Null.MonoidNull (GHC.Internal.Generics.Par1 p)
instance (Data.Monoid.Null.MonoidNull (f a), Data.Monoid.Null.MonoidNull (g a)) => Data.Monoid.Null.MonoidNull (Data.Functor.Product.Product f g a)
instance (GHC.Internal.Num.Num a, GHC.Classes.Eq a) => Data.Monoid.Null.MonoidNull (GHC.Internal.Data.Semigroup.Internal.Product a)
instance Data.Monoid.Null.MonoidNull (GHC.Internal.Data.Proxy.Proxy a)
instance Data.Monoid.Null.MonoidNull (f p) => Data.Monoid.Null.MonoidNull (GHC.Internal.Generics.Rec1 f p)
instance Data.Monoid.Null.MonoidNull (Data.Sequence.Internal.Seq a)
instance GHC.Classes.Ord a => Data.Monoid.Null.MonoidNull (Data.Set.Internal.Set a)
instance (GHC.Internal.Num.Num a, GHC.Classes.Eq a) => Data.Monoid.Null.MonoidNull (GHC.Internal.Data.Semigroup.Internal.Sum a)
instance Data.Monoid.Null.MonoidNull Data.Text.Internal.Lazy.Text
instance Data.Monoid.Null.MonoidNull Data.Text.Internal.Text
instance (Data.Monoid.Null.MonoidNull a, Data.Monoid.Null.MonoidNull b) => Data.Monoid.Null.MonoidNull (a, b)
instance (Data.Monoid.Null.MonoidNull a, Data.Monoid.Null.MonoidNull b, Data.Monoid.Null.MonoidNull c) => Data.Monoid.Null.MonoidNull (a, b, c)
instance (Data.Monoid.Null.MonoidNull a, Data.Monoid.Null.MonoidNull b, Data.Monoid.Null.MonoidNull c, Data.Monoid.Null.MonoidNull d) => Data.Monoid.Null.MonoidNull (a, b, c, d)
instance (Data.Monoid.Null.MonoidNull a, Data.Monoid.Null.MonoidNull b, Data.Monoid.Null.MonoidNull c, Data.Monoid.Null.MonoidNull d, Data.Monoid.Null.MonoidNull e) => Data.Monoid.Null.MonoidNull (a, b, c, d, e)
instance Data.Monoid.Null.MonoidNull (GHC.Internal.Generics.U1 p)
instance Data.Monoid.Null.MonoidNull ()
instance Data.Monoid.Null.MonoidNull (Data.Vector.Vector a)
instance Data.Monoid.Null.MonoidNull a => Data.Monoid.Null.MonoidNull (Data.Semigroup.WrappedMonoid a)
instance Data.Monoid.Null.PositiveMonoid (f (g p)) => Data.Monoid.Null.PositiveMonoid ((GHC.Internal.Generics.:.:) f g p)
instance Data.Monoid.Null.PositiveMonoid GHC.Internal.Data.Semigroup.Internal.All
instance Data.Monoid.Null.PositiveMonoid GHC.Internal.Data.Semigroup.Internal.Any
instance Data.Monoid.Null.PositiveMonoid Data.ByteString.Lazy.Internal.ByteString
instance Data.Monoid.Null.PositiveMonoid Data.ByteString.Internal.Type.ByteString
instance Data.Monoid.Null.PositiveMonoid (f (g a)) => Data.Monoid.Null.PositiveMonoid (Data.Functor.Compose.Compose f g a)
instance Data.Monoid.Null.PositiveMonoid r => Data.Monoid.Null.PositiveMonoid (GHC.Internal.Data.Functor.Const.Const r a)
instance Data.Monoid.Null.PositiveMonoid a => Data.Monoid.Null.PositiveMonoid (GHC.Internal.Data.Ord.Down a)
instance Data.Monoid.Null.PositiveMonoid a => Data.Monoid.Null.PositiveMonoid (GHC.Internal.Data.Semigroup.Internal.Dual a)
instance Data.Monoid.Null.PositiveMonoid (GHC.Internal.Data.Monoid.First a)
instance Data.Monoid.Null.PositiveMonoid a => Data.Monoid.Null.PositiveMonoid (GHC.Internal.Data.Functor.Identity.Identity a)
instance Data.Monoid.Null.PositiveMonoid (Data.IntMap.Internal.IntMap v)
instance Data.Monoid.Null.PositiveMonoid Data.IntSet.Internal.IntSet
instance Data.Monoid.Null.PositiveMonoid c => Data.Monoid.Null.PositiveMonoid (GHC.Internal.Generics.K1 i c p)
instance Data.Monoid.Null.PositiveMonoid (GHC.Internal.Data.Monoid.Last a)
instance Data.Monoid.Null.PositiveMonoid [x]
instance Data.Monoid.Null.PositiveMonoid (f p) => Data.Monoid.Null.PositiveMonoid (GHC.Internal.Generics.M1 i c f p)
instance GHC.Classes.Ord k => Data.Monoid.Null.PositiveMonoid (Data.Map.Internal.Map k v)
instance (GHC.Classes.Ord a, GHC.Internal.Enum.Bounded a) => Data.Monoid.Null.PositiveMonoid (Data.Semigroup.Max a)
instance GHC.Internal.Base.Monoid a => Data.Monoid.Null.PositiveMonoid (GHC.Internal.Maybe.Maybe a)
instance (GHC.Classes.Ord a, GHC.Internal.Enum.Bounded a) => Data.Monoid.Null.PositiveMonoid (Data.Semigroup.Min a)
instance Data.Monoid.Null.PositiveMonoid GHC.Types.Ordering
instance Data.Monoid.Null.PositiveMonoid p => Data.Monoid.Null.PositiveMonoid (GHC.Internal.Generics.Par1 p)
instance Data.Monoid.Null.PositiveMonoid (GHC.Internal.Data.Semigroup.Internal.Product GHC.Num.Natural.Natural)
instance Data.Monoid.Null.PositiveMonoid (GHC.Internal.Data.Proxy.Proxy a)
instance Data.Monoid.Null.PositiveMonoid (f p) => Data.Monoid.Null.PositiveMonoid (GHC.Internal.Generics.Rec1 f p)
instance Data.Monoid.Null.PositiveMonoid (Data.Sequence.Internal.Seq a)
instance GHC.Classes.Ord a => Data.Monoid.Null.PositiveMonoid (Data.Set.Internal.Set a)
instance Data.Monoid.Null.PositiveMonoid (GHC.Internal.Data.Semigroup.Internal.Sum GHC.Num.Natural.Natural)
instance Data.Monoid.Null.PositiveMonoid Data.Text.Internal.Lazy.Text
instance Data.Monoid.Null.PositiveMonoid Data.Text.Internal.Text
instance Data.Monoid.Null.PositiveMonoid (GHC.Internal.Generics.U1 p)
instance Data.Monoid.Null.PositiveMonoid ()
instance Data.Monoid.Null.PositiveMonoid (Data.Vector.Vector a)
instance Data.Monoid.Null.PositiveMonoid a => Data.Monoid.Null.PositiveMonoid (Data.Semigroup.WrappedMonoid a)

-- | This module defines the Semigroup => Reductive =>
--   Cancellative class hierarchy.
--   
--   The Reductive class introduces operation </> which
--   is the inverse of <>. For the Sum semigroup, this
--   operation is subtraction; for Product it is division and for
--   Set it's the set difference. A Reductive semigroup is
--   not a full group because </> may return Nothing.
--   
--   The Cancellative subclass does not add any operation but it
--   provides the additional guarantee that <> can always be
--   undone with </>. Thus Sum is Cancellative
--   but Product is not because (0*n)/0 is not defined.
--   
--   All semigroup subclasses listed above are for Abelian, i.e.,
--   commutative or symmetric semigroups. Since most practical semigroups
--   in Haskell are not Abelian, each of the these classes has two
--   symmetric superclasses:
--   
--   
--   
- LeftReductive
--   
- LeftCancellative
--   
- RightReductive
--   
- RightCancellative
--   
module Data.Semigroup.Cancellative

-- | A Commutative semigroup is a Semigroup that follows the
--   rule:
--   
--   
--   a <> b == b <> a
--   
class Semigroup g => Commutative g

-- | Class of Abelian semigroups with a partial inverse for the Semigroup
--   <> operation. The inverse operation </> must
--   satisfy the following laws:
--   
--   
--   maybe a (b <>) (a </> b) == a
--   maybe a (<> b) (a </> b) == a
--   
--   
--   The </> operator is a synonym for both stripPrefix
--   and stripSuffix, which must be equivalent as <> is
--   both associative and commutative.
--   
--   
--   (</>) = flip stripPrefix
--   (</>) = flip stripSuffix
--   
class (Commutative m, LeftReductive m, RightReductive m) => Reductive m
(</>) :: Reductive m => m -> m -> Maybe m
infix 5 </>

-- | Subclass of Reductive where </> is a complete
--   inverse of the Semigroup <> operation. The class
--   instances must satisfy the following additional laws:
--   
--   
--   (a <> b) </> a == Just b
--   (a <> b) </> b == Just a
--   
class (LeftCancellative m, RightCancellative m, Reductive m) => Cancellative m

-- | Helper class to avoid FlexibleInstances
class Num a => SumCancellative a
cancelAddition :: SumCancellative a => a -> a -> Maybe a

-- | Class of semigroups with a left inverse of <>, satisfying
--   the following law:
--   
--   
--   isPrefixOf a b == isJust (stripPrefix a b)
--   maybe b (a <>) (stripPrefix a b) == b
--   a `isPrefixOf` (a <> b)
--   
--   
--   Every instance definition has to implement at least the
--   stripPrefix method.
class Semigroup m => LeftReductive m
isPrefixOf :: LeftReductive m => m -> m -> Bool
stripPrefix :: LeftReductive m => m -> m -> Maybe m

-- | Class of semigroups with a right inverse of <>,
--   satisfying the following law:
--   
--   
--   isSuffixOf a b == isJust (stripSuffix a b)
--   maybe b (<> a) (stripSuffix a b) == b
--   b `isSuffixOf` (a <> b)
--   
--   
--   Every instance definition has to implement at least the
--   stripSuffix method.
class Semigroup m => RightReductive m
isSuffixOf :: RightReductive m => m -> m -> Bool
stripSuffix :: RightReductive m => m -> m -> Maybe m

-- | Subclass of LeftReductive where stripPrefix is a
--   complete inverse of <>, satisfying the following
--   additional law:
--   
--   
--   stripPrefix a (a <> b) == Just b
--   
class LeftReductive m => LeftCancellative m

-- | Subclass of LeftReductive where stripPrefix is a
--   complete inverse of <>, satisfying the following
--   additional law:
--   
--   
--   stripSuffix b (a <> b) == Just a
--   
class RightReductive m => RightCancellative m
instance Data.Semigroup.Cancellative.Cancellative a => Data.Semigroup.Cancellative.Cancellative (GHC.Internal.Data.Functor.Const.Const a x)
instance Data.Semigroup.Cancellative.Cancellative a => Data.Semigroup.Cancellative.Cancellative (GHC.Internal.Data.Semigroup.Internal.Dual a)
instance Data.Semigroup.Cancellative.Cancellative a => Data.Semigroup.Cancellative.Cancellative (GHC.Internal.Data.Functor.Identity.Identity a)
instance Data.Semigroup.Cancellative.SumCancellative a => Data.Semigroup.Cancellative.Cancellative (GHC.Internal.Data.Semigroup.Internal.Sum a)
instance (Data.Semigroup.Cancellative.Cancellative a, Data.Semigroup.Cancellative.Cancellative b) => Data.Semigroup.Cancellative.Cancellative (a, b)
instance (Data.Semigroup.Cancellative.Cancellative a, Data.Semigroup.Cancellative.Cancellative b, Data.Semigroup.Cancellative.Cancellative c) => Data.Semigroup.Cancellative.Cancellative (a, b, c)
instance (Data.Semigroup.Cancellative.Cancellative a, Data.Semigroup.Cancellative.Cancellative b, Data.Semigroup.Cancellative.Cancellative c, Data.Semigroup.Cancellative.Cancellative d) => Data.Semigroup.Cancellative.Cancellative (a, b, c, d)
instance Data.Semigroup.Cancellative.Cancellative ()
instance Data.Semigroup.Cancellative.LeftCancellative Data.ByteString.Lazy.Internal.ByteString
instance Data.Semigroup.Cancellative.LeftCancellative Data.ByteString.Internal.Type.ByteString
instance Data.Semigroup.Cancellative.LeftCancellative a => Data.Semigroup.Cancellative.LeftCancellative (GHC.Internal.Data.Functor.Const.Const a x)
instance Data.Semigroup.Cancellative.RightCancellative a => Data.Semigroup.Cancellative.LeftCancellative (GHC.Internal.Data.Semigroup.Internal.Dual a)
instance Data.Semigroup.Cancellative.LeftCancellative a => Data.Semigroup.Cancellative.LeftCancellative (GHC.Internal.Data.Functor.Identity.Identity a)
instance GHC.Classes.Eq x => Data.Semigroup.Cancellative.LeftCancellative [x]
instance GHC.Classes.Eq a => Data.Semigroup.Cancellative.LeftCancellative (Data.Sequence.Internal.Seq a)
instance Data.Semigroup.Cancellative.SumCancellative a => Data.Semigroup.Cancellative.LeftCancellative (GHC.Internal.Data.Semigroup.Internal.Sum a)
instance Data.Semigroup.Cancellative.LeftCancellative Data.Text.Internal.Lazy.Text
instance Data.Semigroup.Cancellative.LeftCancellative Data.Text.Internal.Text
instance (Data.Semigroup.Cancellative.LeftCancellative a, Data.Semigroup.Cancellative.LeftCancellative b) => Data.Semigroup.Cancellative.LeftCancellative (a, b)
instance (Data.Semigroup.Cancellative.LeftCancellative a, Data.Semigroup.Cancellative.LeftCancellative b, Data.Semigroup.Cancellative.LeftCancellative c) => Data.Semigroup.Cancellative.LeftCancellative (a, b, c)
instance (Data.Semigroup.Cancellative.LeftCancellative a, Data.Semigroup.Cancellative.LeftCancellative b, Data.Semigroup.Cancellative.LeftCancellative c, Data.Semigroup.Cancellative.LeftCancellative d) => Data.Semigroup.Cancellative.LeftCancellative (a, b, c, d)
instance Data.Semigroup.Cancellative.LeftCancellative ()
instance GHC.Classes.Eq a => Data.Semigroup.Cancellative.LeftCancellative (Data.Vector.Vector a)
instance Data.Semigroup.Cancellative.LeftReductive GHC.Internal.Data.Semigroup.Internal.All
instance Data.Semigroup.Cancellative.LeftReductive GHC.Internal.Data.Semigroup.Internal.Any
instance Data.Semigroup.Cancellative.LeftReductive Data.ByteString.Lazy.Internal.ByteString
instance Data.Semigroup.Cancellative.LeftReductive Data.ByteString.Internal.Type.ByteString
instance Data.Semigroup.Cancellative.LeftReductive a => Data.Semigroup.Cancellative.LeftReductive (GHC.Internal.Data.Functor.Const.Const a b)
instance Data.Semigroup.Cancellative.RightReductive a => Data.Semigroup.Cancellative.LeftReductive (GHC.Internal.Data.Semigroup.Internal.Dual a)
instance Data.Semigroup.Cancellative.LeftReductive a => Data.Semigroup.Cancellative.LeftReductive (GHC.Internal.Data.Functor.Identity.Identity a)
instance GHC.Classes.Eq a => Data.Semigroup.Cancellative.LeftReductive (Data.IntMap.Internal.IntMap a)
instance Data.Semigroup.Cancellative.LeftReductive Data.IntSet.Internal.IntSet
instance GHC.Classes.Eq x => Data.Semigroup.Cancellative.LeftReductive [x]
instance (GHC.Classes.Ord k, GHC.Classes.Eq a) => Data.Semigroup.Cancellative.LeftReductive (Data.Map.Internal.Map k a)
instance GHC.Classes.Ord a => Data.Semigroup.Cancellative.LeftReductive (Data.Semigroup.Max a)
instance Data.Semigroup.Cancellative.LeftReductive x => Data.Semigroup.Cancellative.LeftReductive (GHC.Internal.Maybe.Maybe x)
instance GHC.Classes.Ord a => Data.Semigroup.Cancellative.LeftReductive (Data.Semigroup.Min a)
instance (Numeric.Product.Commutative.CommutativeProduct a, GHC.Internal.Real.Integral a) => Data.Semigroup.Cancellative.LeftReductive (GHC.Internal.Data.Semigroup.Internal.Product a)
instance GHC.Classes.Eq a => Data.Semigroup.Cancellative.LeftReductive (Data.Sequence.Internal.Seq a)
instance GHC.Classes.Ord a => Data.Semigroup.Cancellative.LeftReductive (Data.Set.Internal.Set a)
instance Data.Semigroup.Cancellative.SumCancellative a => Data.Semigroup.Cancellative.LeftReductive (GHC.Internal.Data.Semigroup.Internal.Sum a)
instance Data.Semigroup.Cancellative.LeftReductive Data.Text.Internal.Lazy.Text
instance Data.Semigroup.Cancellative.LeftReductive Data.Text.Internal.Text
instance (Data.Semigroup.Cancellative.LeftReductive a, Data.Semigroup.Cancellative.LeftReductive b) => Data.Semigroup.Cancellative.LeftReductive (a, b)
instance (Data.Semigroup.Cancellative.LeftReductive a, Data.Semigroup.Cancellative.LeftReductive b, Data.Semigroup.Cancellative.LeftReductive c) => Data.Semigroup.Cancellative.LeftReductive (a, b, c)
instance (Data.Semigroup.Cancellative.LeftReductive a, Data.Semigroup.Cancellative.LeftReductive b, Data.Semigroup.Cancellative.LeftReductive c, Data.Semigroup.Cancellative.LeftReductive d) => Data.Semigroup.Cancellative.LeftReductive (a, b, c, d)
instance Data.Semigroup.Cancellative.LeftReductive ()
instance GHC.Classes.Eq a => Data.Semigroup.Cancellative.LeftReductive (Data.Vector.Vector a)
instance Data.Semigroup.Cancellative.Reductive GHC.Internal.Data.Semigroup.Internal.All
instance Data.Semigroup.Cancellative.Reductive GHC.Internal.Data.Semigroup.Internal.Any
instance Data.Semigroup.Cancellative.Reductive a => Data.Semigroup.Cancellative.Reductive (GHC.Internal.Data.Functor.Const.Const a b)
instance Data.Semigroup.Cancellative.Reductive a => Data.Semigroup.Cancellative.Reductive (GHC.Internal.Data.Semigroup.Internal.Dual a)
instance Data.Semigroup.Cancellative.Reductive a => Data.Semigroup.Cancellative.Reductive (GHC.Internal.Data.Functor.Identity.Identity a)
instance Data.Semigroup.Cancellative.Reductive Data.IntSet.Internal.IntSet
instance GHC.Classes.Ord a => Data.Semigroup.Cancellative.Reductive (Data.Semigroup.Max a)
instance Data.Semigroup.Cancellative.Reductive x => Data.Semigroup.Cancellative.Reductive (GHC.Internal.Maybe.Maybe x)
instance GHC.Classes.Ord a => Data.Semigroup.Cancellative.Reductive (Data.Semigroup.Min a)
instance (Numeric.Product.Commutative.CommutativeProduct a, GHC.Internal.Real.Integral a) => Data.Semigroup.Cancellative.Reductive (GHC.Internal.Data.Semigroup.Internal.Product a)
instance GHC.Classes.Ord a => Data.Semigroup.Cancellative.Reductive (Data.Set.Internal.Set a)
instance Data.Semigroup.Cancellative.SumCancellative a => Data.Semigroup.Cancellative.Reductive (GHC.Internal.Data.Semigroup.Internal.Sum a)
instance (Data.Semigroup.Cancellative.Reductive a, Data.Semigroup.Cancellative.Reductive b) => Data.Semigroup.Cancellative.Reductive (a, b)
instance (Data.Semigroup.Cancellative.Reductive a, Data.Semigroup.Cancellative.Reductive b, Data.Semigroup.Cancellative.Reductive c) => Data.Semigroup.Cancellative.Reductive (a, b, c)
instance (Data.Semigroup.Cancellative.Reductive a, Data.Semigroup.Cancellative.Reductive b, Data.Semigroup.Cancellative.Reductive c, Data.Semigroup.Cancellative.Reductive d) => Data.Semigroup.Cancellative.Reductive (a, b, c, d)
instance Data.Semigroup.Cancellative.Reductive ()
instance Data.Semigroup.Cancellative.RightCancellative Data.ByteString.Lazy.Internal.ByteString
instance Data.Semigroup.Cancellative.RightCancellative Data.ByteString.Internal.Type.ByteString
instance Data.Semigroup.Cancellative.RightCancellative a => Data.Semigroup.Cancellative.RightCancellative (GHC.Internal.Data.Functor.Const.Const a x)
instance Data.Semigroup.Cancellative.LeftCancellative a => Data.Semigroup.Cancellative.RightCancellative (GHC.Internal.Data.Semigroup.Internal.Dual a)
instance Data.Semigroup.Cancellative.RightCancellative a => Data.Semigroup.Cancellative.RightCancellative (GHC.Internal.Data.Functor.Identity.Identity a)
instance GHC.Classes.Eq x => Data.Semigroup.Cancellative.RightCancellative [x]
instance GHC.Classes.Eq a => Data.Semigroup.Cancellative.RightCancellative (Data.Sequence.Internal.Seq a)
instance Data.Semigroup.Cancellative.SumCancellative a => Data.Semigroup.Cancellative.RightCancellative (GHC.Internal.Data.Semigroup.Internal.Sum a)
instance Data.Semigroup.Cancellative.RightCancellative Data.Text.Internal.Lazy.Text
instance Data.Semigroup.Cancellative.RightCancellative Data.Text.Internal.Text
instance (Data.Semigroup.Cancellative.RightCancellative a, Data.Semigroup.Cancellative.RightCancellative b) => Data.Semigroup.Cancellative.RightCancellative (a, b)
instance (Data.Semigroup.Cancellative.RightCancellative a, Data.Semigroup.Cancellative.RightCancellative b, Data.Semigroup.Cancellative.RightCancellative c) => Data.Semigroup.Cancellative.RightCancellative (a, b, c)
instance (Data.Semigroup.Cancellative.RightCancellative a, Data.Semigroup.Cancellative.RightCancellative b, Data.Semigroup.Cancellative.RightCancellative c, Data.Semigroup.Cancellative.RightCancellative d) => Data.Semigroup.Cancellative.RightCancellative (a, b, c, d)
instance Data.Semigroup.Cancellative.RightCancellative ()
instance GHC.Classes.Eq a => Data.Semigroup.Cancellative.RightCancellative (Data.Vector.Vector a)
instance Data.Semigroup.Cancellative.RightReductive GHC.Internal.Data.Semigroup.Internal.All
instance Data.Semigroup.Cancellative.RightReductive GHC.Internal.Data.Semigroup.Internal.Any
instance Data.Semigroup.Cancellative.RightReductive Data.ByteString.Lazy.Internal.ByteString
instance Data.Semigroup.Cancellative.RightReductive Data.ByteString.Internal.Type.ByteString
instance Data.Semigroup.Cancellative.RightReductive a => Data.Semigroup.Cancellative.RightReductive (GHC.Internal.Data.Functor.Const.Const a b)
instance Data.Semigroup.Cancellative.LeftReductive a => Data.Semigroup.Cancellative.RightReductive (GHC.Internal.Data.Semigroup.Internal.Dual a)
instance Data.Semigroup.Cancellative.RightReductive a => Data.Semigroup.Cancellative.RightReductive (GHC.Internal.Data.Functor.Identity.Identity a)
instance GHC.Classes.Eq a => Data.Semigroup.Cancellative.RightReductive (Data.IntMap.Internal.IntMap a)
instance Data.Semigroup.Cancellative.RightReductive Data.IntSet.Internal.IntSet
instance GHC.Classes.Eq x => Data.Semigroup.Cancellative.RightReductive [x]
instance (GHC.Classes.Ord k, GHC.Classes.Eq a) => Data.Semigroup.Cancellative.RightReductive (Data.Map.Internal.Map k a)
instance GHC.Classes.Ord a => Data.Semigroup.Cancellative.RightReductive (Data.Semigroup.Max a)
instance Data.Semigroup.Cancellative.RightReductive x => Data.Semigroup.Cancellative.RightReductive (GHC.Internal.Maybe.Maybe x)
instance GHC.Classes.Ord a => Data.Semigroup.Cancellative.RightReductive (Data.Semigroup.Min a)
instance (Numeric.Product.Commutative.CommutativeProduct a, GHC.Internal.Real.Integral a) => Data.Semigroup.Cancellative.RightReductive (GHC.Internal.Data.Semigroup.Internal.Product a)
instance GHC.Classes.Eq a => Data.Semigroup.Cancellative.RightReductive (Data.Sequence.Internal.Seq a)
instance GHC.Classes.Ord a => Data.Semigroup.Cancellative.RightReductive (Data.Set.Internal.Set a)
instance Data.Semigroup.Cancellative.SumCancellative a => Data.Semigroup.Cancellative.RightReductive (GHC.Internal.Data.Semigroup.Internal.Sum a)
instance Data.Semigroup.Cancellative.RightReductive Data.Text.Internal.Lazy.Text
instance Data.Semigroup.Cancellative.RightReductive Data.Text.Internal.Text
instance (Data.Semigroup.Cancellative.RightReductive a, Data.Semigroup.Cancellative.RightReductive b) => Data.Semigroup.Cancellative.RightReductive (a, b)
instance (Data.Semigroup.Cancellative.RightReductive a, Data.Semigroup.Cancellative.RightReductive b, Data.Semigroup.Cancellative.RightReductive c) => Data.Semigroup.Cancellative.RightReductive (a, b, c)
instance (Data.Semigroup.Cancellative.RightReductive a, Data.Semigroup.Cancellative.RightReductive b, Data.Semigroup.Cancellative.RightReductive c, Data.Semigroup.Cancellative.RightReductive d) => Data.Semigroup.Cancellative.RightReductive (a, b, c, d)
instance Data.Semigroup.Cancellative.RightReductive ()
instance GHC.Classes.Eq a => Data.Semigroup.Cancellative.RightReductive (Data.Vector.Vector a)
instance Data.Semigroup.Cancellative.SumCancellative GHC.Types.Int
instance Data.Semigroup.Cancellative.SumCancellative GHC.Num.Integer.Integer
instance Data.Semigroup.Cancellative.SumCancellative GHC.Num.Natural.Natural
instance Data.Semigroup.Cancellative.SumCancellative GHC.Internal.Real.Rational

-- | This module defines the OverlappingGCDMonoid => Monus
--   subclass of the Monoid class.
module Data.Monoid.Monus

-- | Class of Abelian monoids with monus.
--   
--   The monus operation <\> is a synonym for both
--   stripPrefixOverlap and stripSuffixOverlap, which must be
--   equivalent as <> is both associative and commutative:
--   
--   
--   (<\>) = flip stripPrefixOverlap
--   (<\>) = flip stripSuffixOverlap
--   
--   
--   In addition, the monus operation <\> must satisfy the
--   following laws:
--   
--   
--   a <\> a == mempty
--   
--   
--   
--   mempty <\> a == mempty
--   
--   
--   
--   a <> (b <\> a) == b <> (a <\> b)
--   
--   
--   
--   (a <\> b) <\> c == a <\> (b <> c)
--   
class (Commutative m, Monoid m, OverlappingGCDMonoid m) => Monus m
(<\>) :: Monus m => m -> m -> m
infix 5 <\>

-- | Class of monoids for which the greatest overlap can be found between
--   any two values, such that
--   
--   
--   a == a' <> overlap a b
--   b == overlap a b <> b'
--   
--   
--   The methods must satisfy the following laws:
--   
--   
--   stripOverlap a b == (stripSuffixOverlap b a, overlap a b, stripPrefixOverlap a b)
--   stripSuffixOverlap b a <> overlap a b == a
--   overlap a b <> stripPrefixOverlap a b == b
--   
--   
--   The result of overlap a b must be the largest prefix of
--   b and suffix of a, in the sense that it contains any
--   other value x that satifies the property (x
--   isPrefixOf b) && (x isSuffixOf a):
--   
--   
--   ∀x. (x `isPrefixOf` b && x `isSuffixOf` a) => (x `isPrefixOf` overlap a b && x `isSuffixOf` overlap a b)
--   
--   
--   and it must be unique so there's no other value y that
--   satisfies the same properties for every such x:
--   
--   
--   ∀y. ((∀x. (x `isPrefixOf` b && x `isSuffixOf` a) => x `isPrefixOf` y && x `isSuffixOf` y) => y == overlap a b)
--   
--   
--   In addition, the overlap operation must satisfy the following
--   properties:
--   
--   Idempotence
--   
--   
--   overlap a a == a
--   
--   
--   Identity
--   
--   
--   overlap mempty a == mempty
--   
--   
--   
--   overlap a mempty == mempty
--   
class (Monoid m, LeftReductive m, RightReductive m) => OverlappingGCDMonoid m
stripPrefixOverlap :: OverlappingGCDMonoid m => m -> m -> m
stripSuffixOverlap :: OverlappingGCDMonoid m => m -> m -> m
overlap :: OverlappingGCDMonoid m => m -> m -> m
stripOverlap :: OverlappingGCDMonoid m => m -> m -> (m, m, m)
instance Data.Monoid.Monus.Monus a => Data.Monoid.Monus.Monus (GHC.Internal.Data.Functor.Const.Const a b)
instance Data.Monoid.Monus.Monus a => Data.Monoid.Monus.Monus (GHC.Internal.Data.Semigroup.Internal.Dual a)
instance Data.Monoid.Monus.Monus a => Data.Monoid.Monus.Monus (GHC.Internal.Data.Functor.Identity.Identity a)
instance Data.Monoid.Monus.Monus Data.IntSet.Internal.IntSet
instance (Data.Monoid.Monus.Monus a, Data.Monoid.Null.MonoidNull a) => Data.Monoid.Monus.Monus (GHC.Internal.Maybe.Maybe a)
instance Data.Monoid.Monus.Monus (GHC.Internal.Data.Semigroup.Internal.Product GHC.Num.Natural.Natural)
instance GHC.Classes.Ord a => Data.Monoid.Monus.Monus (Data.Set.Internal.Set a)
instance Data.Monoid.Monus.Monus (GHC.Internal.Data.Semigroup.Internal.Sum GHC.Num.Natural.Natural)
instance (Data.Monoid.Monus.Monus a, Data.Monoid.Monus.Monus b) => Data.Monoid.Monus.Monus (a, b)
instance (Data.Monoid.Monus.Monus a, Data.Monoid.Monus.Monus b, Data.Monoid.Monus.Monus c) => Data.Monoid.Monus.Monus (a, b, c)
instance (Data.Monoid.Monus.Monus a, Data.Monoid.Monus.Monus b, Data.Monoid.Monus.Monus c, Data.Monoid.Monus.Monus d) => Data.Monoid.Monus.Monus (a, b, c, d)
instance Data.Monoid.Monus.Monus ()
instance Data.Monoid.Monus.OverlappingGCDMonoid Data.ByteString.Lazy.Internal.ByteString
instance Data.Monoid.Monus.OverlappingGCDMonoid Data.ByteString.Internal.Type.ByteString
instance Data.Monoid.Monus.OverlappingGCDMonoid a => Data.Monoid.Monus.OverlappingGCDMonoid (GHC.Internal.Data.Functor.Const.Const a b)
instance Data.Monoid.Monus.OverlappingGCDMonoid a => Data.Monoid.Monus.OverlappingGCDMonoid (GHC.Internal.Data.Semigroup.Internal.Dual a)
instance Data.Monoid.Monus.OverlappingGCDMonoid a => Data.Monoid.Monus.OverlappingGCDMonoid (GHC.Internal.Data.Functor.Identity.Identity a)
instance GHC.Classes.Eq a => Data.Monoid.Monus.OverlappingGCDMonoid (Data.IntMap.Internal.IntMap a)
instance Data.Monoid.Monus.OverlappingGCDMonoid Data.IntSet.Internal.IntSet
instance GHC.Classes.Eq a => Data.Monoid.Monus.OverlappingGCDMonoid [a]
instance (GHC.Classes.Ord k, GHC.Classes.Eq v) => Data.Monoid.Monus.OverlappingGCDMonoid (Data.Map.Internal.Map k v)
instance (Data.Monoid.Monus.OverlappingGCDMonoid a, Data.Monoid.Null.MonoidNull a) => Data.Monoid.Monus.OverlappingGCDMonoid (GHC.Internal.Maybe.Maybe a)
instance Data.Monoid.Monus.OverlappingGCDMonoid (GHC.Internal.Data.Semigroup.Internal.Product GHC.Num.Natural.Natural)
instance GHC.Classes.Eq a => Data.Monoid.Monus.OverlappingGCDMonoid (Data.Sequence.Internal.Seq a)
instance GHC.Classes.Ord a => Data.Monoid.Monus.OverlappingGCDMonoid (Data.Set.Internal.Set a)
instance Data.Monoid.Monus.OverlappingGCDMonoid (GHC.Internal.Data.Semigroup.Internal.Sum GHC.Num.Natural.Natural)
instance Data.Monoid.Monus.OverlappingGCDMonoid Data.Text.Internal.Lazy.Text
instance Data.Monoid.Monus.OverlappingGCDMonoid Data.Text.Internal.Text
instance (Data.Monoid.Monus.OverlappingGCDMonoid a, Data.Monoid.Monus.OverlappingGCDMonoid b) => Data.Monoid.Monus.OverlappingGCDMonoid (a, b)
instance (Data.Monoid.Monus.OverlappingGCDMonoid a, Data.Monoid.Monus.OverlappingGCDMonoid b, Data.Monoid.Monus.OverlappingGCDMonoid c) => Data.Monoid.Monus.OverlappingGCDMonoid (a, b, c)
instance (Data.Monoid.Monus.OverlappingGCDMonoid a, Data.Monoid.Monus.OverlappingGCDMonoid b, Data.Monoid.Monus.OverlappingGCDMonoid c, Data.Monoid.Monus.OverlappingGCDMonoid d) => Data.Monoid.Monus.OverlappingGCDMonoid (a, b, c, d)
instance Data.Monoid.Monus.OverlappingGCDMonoid ()
instance GHC.Classes.Eq a => Data.Monoid.Monus.OverlappingGCDMonoid (Data.Vector.Vector a)

-- | This module defines the GCDMonoid subclass of the Monoid
--   class.
--   
--   The GCDMonoid subclass adds the gcd operation which
--   takes two monoidal arguments and finds their greatest common divisor,
--   or (more generally) the greatest monoid that can be extracted with the
--   </> operation from both.
--   
--   The GCDMonoid class is for Abelian, i.e.,
--   Commutative monoids.
--   
--   
Non-commutative GCD monoids
--   
--   Since most practical monoids in Haskell are not Abelian, the
--   GCDMonoid class has three symmetric superclasses:
--   
--   
--   
- LeftGCDMonoidClass of monoids for which it is possible to
--   find the greatest common prefix of two monoidal values.
--   
- RightGCDMonoidClass of monoids for which it is possible to
--   find the greatest common suffix of two monoidal values.
--   
- OverlappingGCDMonoidClass of monoids for which it is
--   possible to find the greatest common overlap of two monoidal
--   values.
--   
--   
--   
Distributive GCD monoids
--   
--   Since some (but not all) GCD monoids are also distributive, there are
--   three subclasses that add distributivity:
--   
--   
--   
- DistributiveGCDMonoidSubclass of GCDMonoid with
--   symmetric distributivity.
--   
- LeftDistributiveGCDMonoidSubclass of LeftGCDMonoid
--   with left-distributivity.
--   
- RightDistributiveGCDMonoidSubclass of RightGCDMonoid
--   with right-distributivity.
--   
module Data.Monoid.GCD

-- | Class of Abelian monoids that allow the greatest common divisor to be
--   found for any two given values. The operations must satisfy the
--   following laws:
--   
--   
--   gcd a b == commonPrefix a b == commonSuffix a b
--   Just a' = a </> p && Just b' = b </> p
--      where p = gcd a b
--   
--   
--   In addition, the gcd operation must satisfy the following
--   properties:
--   
--   Uniqueness
--   
--   
--   all isJust
--       [ a </> c
--       , b </> c
--       , c </> gcd a b
--       ]
--   ==>
--       (c == gcd a b)
--   
--   
--   Idempotence
--   
--   
--   gcd a a == a
--   
--   
--   Identity
--   
--   
--   gcd mempty a == mempty
--   
--   
--   
--   gcd a mempty == mempty
--   
--   
--   Commutativity
--   
--   
--   gcd a b == gcd b a
--   
--   
--   Associativity
--   
--   
--   gcd (gcd a b) c == gcd a (gcd b c)
--   
class (Monoid m, Commutative m, Reductive m, LeftGCDMonoid m, RightGCDMonoid m, OverlappingGCDMonoid m) => GCDMonoid m
gcd :: GCDMonoid m => m -> m -> m

-- | Class of monoids capable of finding the equivalent of greatest common
--   divisor on the left side of two monoidal values. The following laws
--   must be respected:
--   
--   
--   stripCommonPrefix a b == (p, a', b')
--      where p = commonPrefix a b
--            Just a' = stripPrefix p a
--            Just b' = stripPrefix p b
--   p == commonPrefix a b && p <> a' == a && p <> b' == b
--      where (p, a', b') = stripCommonPrefix a b
--   
--   
--   Furthermore, commonPrefix must return the unique greatest
--   common prefix that contains, as its prefix, any other prefix
--   x of both values:
--   
--   
--   not (x `isPrefixOf` a && x `isPrefixOf` b) || x `isPrefixOf` commonPrefix a b
--   
--   
--   and it cannot itself be a suffix of any other common prefix y
--   of both values:
--   
--   
--   not (y `isPrefixOf` a && y `isPrefixOf` b && commonPrefix a b `isSuffixOf` y)
--   
--   
--   In addition, the commonPrefix operation must satisfy the
--   following properties:
--   
--   Idempotence
--   
--   
--   commonPrefix a a == a
--   
--   
--   Identity
--   
--   
--   commonPrefix mempty a == mempty
--   
--   
--   
--   commonPrefix a mempty == mempty
--   
--   
--   Commutativity
--   
--   
--   commonPrefix a b == commonPrefix b a
--   
--   
--   Associativity
--   
--   
--   commonPrefix (commonPrefix a b) c
--   ==
--   commonPrefix a (commonPrefix b c)
--   
class (Monoid m, LeftReductive m) => LeftGCDMonoid m
commonPrefix :: LeftGCDMonoid m => m -> m -> m
stripCommonPrefix :: LeftGCDMonoid m => m -> m -> (m, m, m)

-- | Class of monoids capable of finding the equivalent of greatest common
--   divisor on the right side of two monoidal values. The following laws
--   must be respected:
--   
--   
--   stripCommonSuffix a b == (a', b', s)
--      where s = commonSuffix a b
--            Just a' = stripSuffix p a
--            Just b' = stripSuffix p b
--   s == commonSuffix a b && a' <> s == a && b' <> s == b
--      where (a', b', s) = stripCommonSuffix a b
--   
--   
--   Furthermore, commonSuffix must return the unique greatest
--   common suffix that contains, as its suffix, any other suffix
--   x of both values:
--   
--   
--   not (x `isSuffixOf` a && x `isSuffixOf` b) || x `isSuffixOf` commonSuffix a b
--   
--   
--   and it cannot itself be a prefix of any other common suffix y
--   of both values:
--   
--   
--   not (y `isSuffixOf` a && y `isSuffixOf` b && commonSuffix a b `isPrefixOf` y)
--   
--   
--   In addition, the commonSuffix operation must satisfy the
--   following properties:
--   
--   Idempotence
--   
--   
--   commonSuffix a a == a
--   
--   
--   Identity
--   
--   
--   commonSuffix mempty a == mempty
--   
--   
--   
--   commonSuffix a mempty == mempty
--   
--   
--   Commutativity
--   
--   
--   commonSuffix a b == commonSuffix b a
--   
--   
--   Associativity
--   
--   
--   commonSuffix (commonSuffix a b) c
--   ==
--   commonSuffix a (commonSuffix b c)
--   
class (Monoid m, RightReductive m) => RightGCDMonoid m
commonSuffix :: RightGCDMonoid m => m -> m -> m
stripCommonSuffix :: RightGCDMonoid m => m -> m -> (m, m, m)

-- | Class of monoids for which the greatest overlap can be found between
--   any two values, such that
--   
--   
--   a == a' <> overlap a b
--   b == overlap a b <> b'
--   
--   
--   The methods must satisfy the following laws:
--   
--   
--   stripOverlap a b == (stripSuffixOverlap b a, overlap a b, stripPrefixOverlap a b)
--   stripSuffixOverlap b a <> overlap a b == a
--   overlap a b <> stripPrefixOverlap a b == b
--   
--   
--   The result of overlap a b must be the largest prefix of
--   b and suffix of a, in the sense that it contains any
--   other value x that satifies the property (x
--   isPrefixOf b) && (x isSuffixOf a):
--   
--   
--   ∀x. (x `isPrefixOf` b && x `isSuffixOf` a) => (x `isPrefixOf` overlap a b && x `isSuffixOf` overlap a b)
--   
--   
--   and it must be unique so there's no other value y that
--   satisfies the same properties for every such x:
--   
--   
--   ∀y. ((∀x. (x `isPrefixOf` b && x `isSuffixOf` a) => x `isPrefixOf` y && x `isSuffixOf` y) => y == overlap a b)
--   
--   
--   In addition, the overlap operation must satisfy the following
--   properties:
--   
--   Idempotence
--   
--   
--   overlap a a == a
--   
--   
--   Identity
--   
--   
--   overlap mempty a == mempty
--   
--   
--   
--   overlap a mempty == mempty
--   
class (Monoid m, LeftReductive m, RightReductive m) => OverlappingGCDMonoid m
stripPrefixOverlap :: OverlappingGCDMonoid m => m -> m -> m
stripSuffixOverlap :: OverlappingGCDMonoid m => m -> m -> m
overlap :: OverlappingGCDMonoid m => m -> m -> m
stripOverlap :: OverlappingGCDMonoid m => m -> m -> (m, m, m)

-- | Class of commutative GCD monoids with symmetric
--   distributivity.
--   
--   In addition to the general GCDMonoid laws, instances of this
--   class must also satisfy the following laws:
--   
--   
--   gcd (a <> b) (a <> c) == a <> gcd b c
--   
--   
--   
--   gcd (a <> c) (b <> c) == gcd a b <> c
--   
class (LeftDistributiveGCDMonoid m, RightDistributiveGCDMonoid m, GCDMonoid m) => DistributiveGCDMonoid m

-- | Class of left GCD monoids with left-distributivity.
--   
--   In addition to the general LeftGCDMonoid laws, instances of
--   this class must also satisfy the following law:
--   
--   
--   commonPrefix (a <> b) (a <> c) == a <> commonPrefix b c
--   
class LeftGCDMonoid m => LeftDistributiveGCDMonoid m

-- | Class of right GCD monoids with right-distributivity.
--   
--   In addition to the general RightGCDMonoid laws, instances of
--   this class must also satisfy the following law:
--   
--   
--   commonSuffix (a <> c) (b <> c) == commonSuffix a b <> c
--   
class RightGCDMonoid m => RightDistributiveGCDMonoid m
instance Data.Monoid.GCD.DistributiveGCDMonoid a => Data.Monoid.GCD.DistributiveGCDMonoid (GHC.Internal.Data.Functor.Const.Const a b)
instance Data.Monoid.GCD.DistributiveGCDMonoid a => Data.Monoid.GCD.DistributiveGCDMonoid (GHC.Internal.Data.Semigroup.Internal.Dual a)
instance Data.Monoid.GCD.DistributiveGCDMonoid a => Data.Monoid.GCD.DistributiveGCDMonoid (GHC.Internal.Data.Functor.Identity.Identity a)
instance Data.Monoid.GCD.DistributiveGCDMonoid Data.IntSet.Internal.IntSet
instance Data.Monoid.GCD.DistributiveGCDMonoid (GHC.Internal.Data.Semigroup.Internal.Product GHC.Num.Natural.Natural)
instance GHC.Classes.Ord a => Data.Monoid.GCD.DistributiveGCDMonoid (Data.Set.Internal.Set a)
instance Data.Monoid.GCD.DistributiveGCDMonoid (GHC.Internal.Data.Semigroup.Internal.Sum GHC.Num.Natural.Natural)
instance Data.Monoid.GCD.DistributiveGCDMonoid ()
instance Data.Monoid.GCD.GCDMonoid a => Data.Monoid.GCD.GCDMonoid (GHC.Internal.Data.Functor.Const.Const a b)
instance Data.Monoid.GCD.GCDMonoid a => Data.Monoid.GCD.GCDMonoid (GHC.Internal.Data.Semigroup.Internal.Dual a)
instance Data.Monoid.GCD.GCDMonoid a => Data.Monoid.GCD.GCDMonoid (GHC.Internal.Data.Functor.Identity.Identity a)
instance Data.Monoid.GCD.GCDMonoid Data.IntSet.Internal.IntSet
instance Data.Monoid.GCD.GCDMonoid (GHC.Internal.Data.Semigroup.Internal.Product GHC.Num.Natural.Natural)
instance GHC.Classes.Ord a => Data.Monoid.GCD.GCDMonoid (Data.Set.Internal.Set a)
instance Data.Monoid.GCD.GCDMonoid (GHC.Internal.Data.Semigroup.Internal.Sum GHC.Num.Natural.Natural)
instance (Data.Monoid.GCD.GCDMonoid a, Data.Monoid.GCD.GCDMonoid b) => Data.Monoid.GCD.GCDMonoid (a, b)
instance (Data.Monoid.GCD.GCDMonoid a, Data.Monoid.GCD.GCDMonoid b, Data.Monoid.GCD.GCDMonoid c) => Data.Monoid.GCD.GCDMonoid (a, b, c)
instance (Data.Monoid.GCD.GCDMonoid a, Data.Monoid.GCD.GCDMonoid b, Data.Monoid.GCD.GCDMonoid c, Data.Monoid.GCD.GCDMonoid d) => Data.Monoid.GCD.GCDMonoid (a, b, c, d)
instance Data.Monoid.GCD.GCDMonoid ()
instance Data.Monoid.GCD.LeftDistributiveGCDMonoid Data.ByteString.Lazy.Internal.ByteString
instance Data.Monoid.GCD.LeftDistributiveGCDMonoid Data.ByteString.Internal.Type.ByteString
instance Data.Monoid.GCD.LeftDistributiveGCDMonoid a => Data.Monoid.GCD.LeftDistributiveGCDMonoid (GHC.Internal.Data.Functor.Const.Const a b)
instance Data.Monoid.GCD.RightDistributiveGCDMonoid a => Data.Monoid.GCD.LeftDistributiveGCDMonoid (GHC.Internal.Data.Semigroup.Internal.Dual a)
instance Data.Monoid.GCD.LeftDistributiveGCDMonoid a => Data.Monoid.GCD.LeftDistributiveGCDMonoid (GHC.Internal.Data.Functor.Identity.Identity a)
instance Data.Monoid.GCD.LeftDistributiveGCDMonoid Data.IntSet.Internal.IntSet
instance GHC.Classes.Eq a => Data.Monoid.GCD.LeftDistributiveGCDMonoid [a]
instance Data.Monoid.GCD.LeftDistributiveGCDMonoid (GHC.Internal.Data.Semigroup.Internal.Product GHC.Num.Natural.Natural)
instance GHC.Classes.Eq a => Data.Monoid.GCD.LeftDistributiveGCDMonoid (Data.Sequence.Internal.Seq a)
instance GHC.Classes.Ord a => Data.Monoid.GCD.LeftDistributiveGCDMonoid (Data.Set.Internal.Set a)
instance Data.Monoid.GCD.LeftDistributiveGCDMonoid (GHC.Internal.Data.Semigroup.Internal.Sum GHC.Num.Natural.Natural)
instance Data.Monoid.GCD.LeftDistributiveGCDMonoid Data.Text.Internal.Lazy.Text
instance Data.Monoid.GCD.LeftDistributiveGCDMonoid Data.Text.Internal.Text
instance Data.Monoid.GCD.LeftDistributiveGCDMonoid ()
instance GHC.Classes.Eq a => Data.Monoid.GCD.LeftDistributiveGCDMonoid (Data.Vector.Vector a)
instance Data.Monoid.GCD.LeftGCDMonoid Data.ByteString.Lazy.Internal.ByteString
instance Data.Monoid.GCD.LeftGCDMonoid Data.ByteString.Internal.Type.ByteString
instance Data.Monoid.GCD.LeftGCDMonoid a => Data.Monoid.GCD.LeftGCDMonoid (GHC.Internal.Data.Functor.Const.Const a b)
instance Data.Monoid.GCD.RightGCDMonoid a => Data.Monoid.GCD.LeftGCDMonoid (GHC.Internal.Data.Semigroup.Internal.Dual a)
instance Data.Monoid.GCD.LeftGCDMonoid a => Data.Monoid.GCD.LeftGCDMonoid (GHC.Internal.Data.Functor.Identity.Identity a)
instance GHC.Classes.Eq a => Data.Monoid.GCD.LeftGCDMonoid (Data.IntMap.Internal.IntMap a)
instance Data.Monoid.GCD.LeftGCDMonoid Data.IntSet.Internal.IntSet
instance GHC.Classes.Eq x => Data.Monoid.GCD.LeftGCDMonoid [x]
instance (GHC.Classes.Ord k, GHC.Classes.Eq a) => Data.Monoid.GCD.LeftGCDMonoid (Data.Map.Internal.Map k a)
instance Data.Monoid.GCD.LeftGCDMonoid x => Data.Monoid.GCD.LeftGCDMonoid (GHC.Internal.Maybe.Maybe x)
instance Data.Monoid.GCD.LeftGCDMonoid (GHC.Internal.Data.Semigroup.Internal.Product GHC.Num.Natural.Natural)
instance GHC.Classes.Eq a => Data.Monoid.GCD.LeftGCDMonoid (Data.Sequence.Internal.Seq a)
instance GHC.Classes.Ord a => Data.Monoid.GCD.LeftGCDMonoid (Data.Set.Internal.Set a)
instance Data.Monoid.GCD.LeftGCDMonoid (GHC.Internal.Data.Semigroup.Internal.Sum GHC.Num.Natural.Natural)
instance Data.Monoid.GCD.LeftGCDMonoid Data.Text.Internal.Lazy.Text
instance Data.Monoid.GCD.LeftGCDMonoid Data.Text.Internal.Text
instance (Data.Monoid.GCD.LeftGCDMonoid a, Data.Monoid.GCD.LeftGCDMonoid b) => Data.Monoid.GCD.LeftGCDMonoid (a, b)
instance (Data.Monoid.GCD.LeftGCDMonoid a, Data.Monoid.GCD.LeftGCDMonoid b, Data.Monoid.GCD.LeftGCDMonoid c) => Data.Monoid.GCD.LeftGCDMonoid (a, b, c)
instance (Data.Monoid.GCD.LeftGCDMonoid a, Data.Monoid.GCD.LeftGCDMonoid b, Data.Monoid.GCD.LeftGCDMonoid c, Data.Monoid.GCD.LeftGCDMonoid d) => Data.Monoid.GCD.LeftGCDMonoid (a, b, c, d)
instance Data.Monoid.GCD.LeftGCDMonoid ()
instance GHC.Classes.Eq a => Data.Monoid.GCD.LeftGCDMonoid (Data.Vector.Vector a)
instance Data.Monoid.GCD.RightDistributiveGCDMonoid Data.ByteString.Lazy.Internal.ByteString
instance Data.Monoid.GCD.RightDistributiveGCDMonoid Data.ByteString.Internal.Type.ByteString
instance Data.Monoid.GCD.RightDistributiveGCDMonoid a => Data.Monoid.GCD.RightDistributiveGCDMonoid (GHC.Internal.Data.Functor.Const.Const a b)
instance Data.Monoid.GCD.LeftDistributiveGCDMonoid a => Data.Monoid.GCD.RightDistributiveGCDMonoid (GHC.Internal.Data.Semigroup.Internal.Dual a)
instance Data.Monoid.GCD.RightDistributiveGCDMonoid a => Data.Monoid.GCD.RightDistributiveGCDMonoid (GHC.Internal.Data.Functor.Identity.Identity a)
instance Data.Monoid.GCD.RightDistributiveGCDMonoid Data.IntSet.Internal.IntSet
instance GHC.Classes.Eq a => Data.Monoid.GCD.RightDistributiveGCDMonoid [a]
instance Data.Monoid.GCD.RightDistributiveGCDMonoid (GHC.Internal.Data.Semigroup.Internal.Product GHC.Num.Natural.Natural)
instance GHC.Classes.Eq a => Data.Monoid.GCD.RightDistributiveGCDMonoid (Data.Sequence.Internal.Seq a)
instance GHC.Classes.Ord a => Data.Monoid.GCD.RightDistributiveGCDMonoid (Data.Set.Internal.Set a)
instance Data.Monoid.GCD.RightDistributiveGCDMonoid (GHC.Internal.Data.Semigroup.Internal.Sum GHC.Num.Natural.Natural)
instance Data.Monoid.GCD.RightDistributiveGCDMonoid Data.Text.Internal.Lazy.Text
instance Data.Monoid.GCD.RightDistributiveGCDMonoid Data.Text.Internal.Text
instance Data.Monoid.GCD.RightDistributiveGCDMonoid ()
instance GHC.Classes.Eq a => Data.Monoid.GCD.RightDistributiveGCDMonoid (Data.Vector.Vector a)
instance Data.Monoid.GCD.RightGCDMonoid Data.ByteString.Lazy.Internal.ByteString
instance Data.Monoid.GCD.RightGCDMonoid Data.ByteString.Internal.Type.ByteString
instance Data.Monoid.GCD.RightGCDMonoid a => Data.Monoid.GCD.RightGCDMonoid (GHC.Internal.Data.Functor.Const.Const a b)
instance Data.Monoid.GCD.LeftGCDMonoid a => Data.Monoid.GCD.RightGCDMonoid (GHC.Internal.Data.Semigroup.Internal.Dual a)
instance Data.Monoid.GCD.RightGCDMonoid a => Data.Monoid.GCD.RightGCDMonoid (GHC.Internal.Data.Functor.Identity.Identity a)
instance Data.Monoid.GCD.RightGCDMonoid Data.IntSet.Internal.IntSet
instance GHC.Classes.Eq x => Data.Monoid.GCD.RightGCDMonoid [x]
instance Data.Monoid.GCD.RightGCDMonoid x => Data.Monoid.GCD.RightGCDMonoid (GHC.Internal.Maybe.Maybe x)
instance Data.Monoid.GCD.RightGCDMonoid (GHC.Internal.Data.Semigroup.Internal.Product GHC.Num.Natural.Natural)
instance GHC.Classes.Eq a => Data.Monoid.GCD.RightGCDMonoid (Data.Sequence.Internal.Seq a)
instance GHC.Classes.Ord a => Data.Monoid.GCD.RightGCDMonoid (Data.Set.Internal.Set a)
instance Data.Monoid.GCD.RightGCDMonoid (GHC.Internal.Data.Semigroup.Internal.Sum GHC.Num.Natural.Natural)
instance Data.Monoid.GCD.RightGCDMonoid Data.Text.Internal.Lazy.Text
instance Data.Monoid.GCD.RightGCDMonoid Data.Text.Internal.Text
instance (Data.Monoid.GCD.RightGCDMonoid a, Data.Monoid.GCD.RightGCDMonoid b) => Data.Monoid.GCD.RightGCDMonoid (a, b)
instance (Data.Monoid.GCD.RightGCDMonoid a, Data.Monoid.GCD.RightGCDMonoid b, Data.Monoid.GCD.RightGCDMonoid c) => Data.Monoid.GCD.RightGCDMonoid (a, b, c)
instance (Data.Monoid.GCD.RightGCDMonoid a, Data.Monoid.GCD.RightGCDMonoid b, Data.Monoid.GCD.RightGCDMonoid c, Data.Monoid.GCD.RightGCDMonoid d) => Data.Monoid.GCD.RightGCDMonoid (a, b, c, d)
instance Data.Monoid.GCD.RightGCDMonoid ()
instance GHC.Classes.Eq a => Data.Monoid.GCD.RightGCDMonoid (Data.Vector.Vector a)

-- | This module defines the LCMMonoid subclass of the Monoid
--   class.
--   
--   The LCMMonoid subclass adds the lcm operation, which
--   takes two monoidal arguments and finds their least common
--   multiple, or (more generally) the least monoid from which either
--   argument can be subtracted with the </> operation.
--   
--   For LCM monoids that are distributive, this module also provides the
--   DistributiveLCMMonoid subclass of LCMMonoid.
--   
--   All classes in this module are for Abelian, i.e.,
--   Commutative monoids.
module Data.Monoid.LCM

-- | Class of Abelian monoids that allow the least common multiple
--   to be found for any two given values.
--   
--   Operations must satisfy the following laws:
--   
--   Reductivity
--   
--   
--   isJust (lcm a b </> a)
--   
--   
--   
--   isJust (lcm a b </> b)
--   
--   
--   Uniqueness
--   
--   
--   all isJust
--       [       c </> a
--       ,       c </> b
--       , lcm a b </> c
--       ]
--   ==>
--       (lcm a b == c)
--   
--   
--   Idempotence
--   
--   
--   lcm a a == a
--   
--   
--   Identity
--   
--   
--   lcm mempty a == a
--   
--   
--   
--   lcm a mempty == a
--   
--   
--   Commutativity
--   
--   
--   lcm a b == lcm b a
--   
--   
--   Associativity
--   
--   
--   lcm (lcm a b) c == lcm a (lcm b c)
--   
--   
--   Absorption
--   
--   
--   lcm a (gcd a b) == a
--   
--   
--   
--   gcd a (lcm a b) == a
--   
class GCDMonoid m => LCMMonoid m
lcm :: LCMMonoid m => m -> m -> m

-- | Class of commutative LCM monoids with distributivity.
--   
--   In addition to the general LCMMonoid laws, instances of this
--   class must also satisfy the following laws:
--   
--   The lcm operation itself must be both left-distributive
--   and right-distributive:
--   
--   
--   lcm (a <> b) (a <> c) == a <> lcm b c
--   
--   
--   
--   lcm (a <> c) (b <> c) == lcm a b <> c
--   
--   
--   The lcm and gcd operations must distribute over one
--   another:
--   
--   
--   lcm a (gcd b c) == gcd (lcm a b) (lcm a c)
--   
--   
--   
--   gcd a (lcm b c) == lcm (gcd a b) (gcd a c)
--   
class (DistributiveGCDMonoid m, LCMMonoid m) => DistributiveLCMMonoid m
instance Data.Monoid.LCM.DistributiveLCMMonoid a => Data.Monoid.LCM.DistributiveLCMMonoid (GHC.Internal.Data.Functor.Const.Const a b)
instance Data.Monoid.LCM.DistributiveLCMMonoid a => Data.Monoid.LCM.DistributiveLCMMonoid (GHC.Internal.Data.Semigroup.Internal.Dual a)
instance Data.Monoid.LCM.DistributiveLCMMonoid a => Data.Monoid.LCM.DistributiveLCMMonoid (GHC.Internal.Data.Functor.Identity.Identity a)
instance Data.Monoid.LCM.DistributiveLCMMonoid Data.IntSet.Internal.IntSet
instance Data.Monoid.LCM.DistributiveLCMMonoid (GHC.Internal.Data.Semigroup.Internal.Product GHC.Num.Natural.Natural)
instance GHC.Classes.Ord a => Data.Monoid.LCM.DistributiveLCMMonoid (Data.Set.Internal.Set a)
instance Data.Monoid.LCM.DistributiveLCMMonoid (GHC.Internal.Data.Semigroup.Internal.Sum GHC.Num.Natural.Natural)
instance Data.Monoid.LCM.DistributiveLCMMonoid ()
instance Data.Monoid.LCM.LCMMonoid a => Data.Monoid.LCM.LCMMonoid (GHC.Internal.Data.Functor.Const.Const a b)
instance Data.Monoid.LCM.LCMMonoid a => Data.Monoid.LCM.LCMMonoid (GHC.Internal.Data.Semigroup.Internal.Dual a)
instance Data.Monoid.LCM.LCMMonoid a => Data.Monoid.LCM.LCMMonoid (GHC.Internal.Data.Functor.Identity.Identity a)
instance Data.Monoid.LCM.LCMMonoid Data.IntSet.Internal.IntSet
instance Data.Monoid.LCM.LCMMonoid (GHC.Internal.Data.Semigroup.Internal.Product GHC.Num.Natural.Natural)
instance GHC.Classes.Ord a => Data.Monoid.LCM.LCMMonoid (Data.Set.Internal.Set a)
instance Data.Monoid.LCM.LCMMonoid (GHC.Internal.Data.Semigroup.Internal.Sum GHC.Num.Natural.Natural)
instance (Data.Monoid.LCM.LCMMonoid a, Data.Monoid.LCM.LCMMonoid b) => Data.Monoid.LCM.LCMMonoid (a, b)
instance (Data.Monoid.LCM.LCMMonoid a, Data.Monoid.LCM.LCMMonoid b, Data.Monoid.LCM.LCMMonoid c) => Data.Monoid.LCM.LCMMonoid (a, b, c)
instance (Data.Monoid.LCM.LCMMonoid a, Data.Monoid.LCM.LCMMonoid b, Data.Monoid.LCM.LCMMonoid c, Data.Monoid.LCM.LCMMonoid d) => Data.Monoid.LCM.LCMMonoid (a, b, c, d)
instance Data.Monoid.LCM.LCMMonoid ()

-- | This module defines the Monoid => CommutativeMonoid
--   => ReductiveMonoid => CancellativeMonoid
--   constraint synonym hierarchy.
--   
--   Since most practical monoids in Haskell are not commutative, the last
--   two of these synonyms have two symmetric superclasses each:
--   
--   
--   
- LeftReductiveMonoid
--   
- LeftCancellativeMonoid
--   
- RightReductiveMonoid
--   
- RightCancellativeMonoid
--   
--   
--   This module and its constraint synonyms are provided for compatibility
--   with the older versions of the monoid-sublasses library.
--   Starting with version 1.0, the classes from the
--   Data.Semigroup.Cancellative module are recommended instead.
module Data.Monoid.Cancellative
type CommutativeMonoid m = (Monoid m, Commutative m)
type ReductiveMonoid m = (Monoid m, Reductive m)
type CancellativeMonoid m = (Monoid m, Cancellative m)
type LeftReductiveMonoid m = (Monoid m, LeftReductive m)
type RightReductiveMonoid m = (Monoid m, RightReductive m)
type LeftCancellativeMonoid m = (Monoid m, LeftCancellative m)
type RightCancellativeMonoid m = (Monoid m, RightCancellative m)

-- | This module defines the Semigroup => Factorial =>
--   StableFactorial classes and some of their instances.
module Data.Semigroup.Factorial

-- | Class of semigroups 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:
--   
--   
--   maybe id sconcat  . nonEmpty . factors == id
--   List.all (\prime-> factors prime == [prime]) . factors
--   primePrefix s == foldr const s s
--   foldl f a == List.foldl f a . factors
--   foldl' f a == List.foldl' f a . factors
--   foldr f a == List.foldr f a . factors
--   
--   
--   A minimal instance definition must implement factors or
--   foldr. Other methods can and should be implemented only for
--   performance reasons.
class Semigroup m => Factorial m

-- | Returns a list of all prime factors; inverse of mconcat.
factors :: Factorial m => m -> [m]

-- | The prime prefix; primePrefix mempty == mempty for monoids.
primePrefix :: Factorial m => m -> m

-- | The prime suffix; primeSuffix mempty == mempty for monoids.
primeSuffix :: Factorial m => m -> m

-- | Like foldl from Data.List on the list of prime
--   factors.
foldl :: Factorial m => (a -> m -> a) -> a -> m -> a

-- | Like foldl' from Data.List on the list of prime
--   factors.
foldl' :: Factorial m => (a -> m -> a) -> a -> m -> a

-- | Like foldr from Data.List on the list of prime
--   factors.
foldr :: Factorial m => (m -> a -> a) -> a -> m -> a

-- | The length of the list of prime factors.
length :: Factorial m => m -> Int

-- | Generalizes foldMap from Data.Foldable, except the
--   function arguments are prime factors rather than the structure
--   elements.
foldMap :: (Factorial m, Monoid n) => (m -> n) -> m -> n

-- | Equivalent to reverse from Data.List.
reverse :: Factorial m => m -> m

-- | A subclass of Factorial whose instances satisfy the following
--   additional laws:
--   
--   
--   factors (a <> b) == factors a <> factors b
--   factors . reverse == List.reverse . factors
--   primeSuffix s == primePrefix (reverse s)
--   
class Factorial m => StableFactorial m

-- | A mapM equivalent.
mapM :: (Factorial a, Semigroup b, Monoid b, Monad m) => (a -> m b) -> a -> m b

-- | A mapM_ equivalent.
mapM_ :: (Factorial a, Applicative m) => (a -> m b) -> a -> m ()
instance Data.Semigroup.Factorial.Factorial Data.ByteString.Lazy.Internal.ByteString
instance Data.Semigroup.Factorial.Factorial Data.ByteString.Internal.Type.ByteString
instance Data.Semigroup.Factorial.Factorial a => Data.Semigroup.Factorial.Factorial (GHC.Internal.Data.Functor.Const.Const a b)
instance Data.Semigroup.Factorial.Factorial a => Data.Semigroup.Factorial.Factorial (GHC.Internal.Data.Semigroup.Internal.Dual a)
instance Data.Semigroup.Factorial.Factorial a => Data.Semigroup.Factorial.Factorial (GHC.Internal.Data.Functor.Identity.Identity a)
instance Data.Semigroup.Factorial.Factorial (Data.IntMap.Internal.IntMap a)
instance Data.Semigroup.Factorial.Factorial Data.IntSet.Internal.IntSet
instance Data.Semigroup.Factorial.Factorial [x]
instance GHC.Classes.Ord k => Data.Semigroup.Factorial.Factorial (Data.Map.Internal.Map k v)
instance Data.Semigroup.Factorial.Factorial a => Data.Semigroup.Factorial.Factorial (GHC.Internal.Maybe.Maybe a)
instance GHC.Internal.Real.Integral a => Data.Semigroup.Factorial.Factorial (GHC.Internal.Data.Semigroup.Internal.Product a)
instance Data.Semigroup.Factorial.Factorial (Data.Sequence.Internal.Seq a)
instance GHC.Classes.Ord a => Data.Semigroup.Factorial.Factorial (Data.Set.Internal.Set a)
instance (GHC.Internal.Real.Integral a, GHC.Classes.Eq a) => Data.Semigroup.Factorial.Factorial (GHC.Internal.Data.Semigroup.Internal.Sum a)
instance Data.Semigroup.Factorial.Factorial Data.Text.Internal.Lazy.Text
instance Data.Semigroup.Factorial.Factorial Data.Text.Internal.Text
instance (Data.Semigroup.Factorial.Factorial a, Data.Semigroup.Factorial.Factorial b, Data.Monoid.Null.MonoidNull a, Data.Monoid.Null.MonoidNull b) => Data.Semigroup.Factorial.Factorial (a, b)
instance (Data.Semigroup.Factorial.Factorial a, Data.Semigroup.Factorial.Factorial b, Data.Semigroup.Factorial.Factorial c, Data.Monoid.Null.MonoidNull a, Data.Monoid.Null.MonoidNull b, Data.Monoid.Null.MonoidNull c) => Data.Semigroup.Factorial.Factorial (a, b, c)
instance (Data.Semigroup.Factorial.Factorial a, Data.Semigroup.Factorial.Factorial b, Data.Semigroup.Factorial.Factorial c, Data.Semigroup.Factorial.Factorial d, Data.Monoid.Null.MonoidNull a, Data.Monoid.Null.MonoidNull b, Data.Monoid.Null.MonoidNull c, Data.Monoid.Null.MonoidNull d) => Data.Semigroup.Factorial.Factorial (a, b, c, d)
instance Data.Semigroup.Factorial.Factorial ()
instance Data.Semigroup.Factorial.Factorial (Data.Vector.Vector a)
instance Data.Semigroup.Factorial.StableFactorial Data.ByteString.Lazy.Internal.ByteString
instance Data.Semigroup.Factorial.StableFactorial Data.ByteString.Internal.Type.ByteString
instance Data.Semigroup.Factorial.StableFactorial a => Data.Semigroup.Factorial.StableFactorial (GHC.Internal.Data.Functor.Const.Const a b)
instance Data.Semigroup.Factorial.StableFactorial a => Data.Semigroup.Factorial.StableFactorial (GHC.Internal.Data.Semigroup.Internal.Dual a)
instance Data.Semigroup.Factorial.StableFactorial a => Data.Semigroup.Factorial.StableFactorial (GHC.Internal.Data.Functor.Identity.Identity a)
instance Data.Semigroup.Factorial.StableFactorial [x]
instance Data.Semigroup.Factorial.StableFactorial (Data.Sequence.Internal.Seq a)
instance Data.Semigroup.Factorial.StableFactorial (GHC.Internal.Data.Semigroup.Internal.Sum GHC.Num.Natural.Natural)
instance Data.Semigroup.Factorial.StableFactorial Data.Text.Internal.Lazy.Text
instance Data.Semigroup.Factorial.StableFactorial Data.Text.Internal.Text
instance Data.Semigroup.Factorial.StableFactorial ()
instance Data.Semigroup.Factorial.StableFactorial (Data.Vector.Vector a)

-- | This module defines the FactorialMonoid class and some of its
--   instances.
module Data.Monoid.Factorial

-- | 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.
class (Factorial m, MonoidNull m) => FactorialMonoid m

-- | Splits the argument into its prime prefix and the remaining suffix.
--   Returns Nothing for mempty.
splitPrimePrefix :: FactorialMonoid m => m -> Maybe (m, m)

-- | Splits the argument into its prime suffix and the remaining prefix.
--   Returns Nothing for mempty.
splitPrimeSuffix :: FactorialMonoid m => m -> Maybe (m, m)

-- | Returns the list of all prefixes of the argument, mempty first.
inits :: FactorialMonoid m => m -> [m]

-- | Returns the list of all suffixes of the argument, mempty last.
tails :: FactorialMonoid m => m -> [m]

-- | Like span from Data.List on the list of prime
--   factors.
span :: FactorialMonoid m => (m -> Bool) -> m -> (m, m)

-- | Equivalent to break from Data.List.
break :: FactorialMonoid m => (m -> Bool) -> m -> (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.
split :: FactorialMonoid m => (m -> Bool) -> m -> [m]

-- | Equivalent to takeWhile from Data.List.
takeWhile :: FactorialMonoid m => (m -> Bool) -> m -> m

-- | Equivalent to dropWhile from Data.List.
dropWhile :: FactorialMonoid m => (m -> Bool) -> m -> m

-- | A stateful variant of span, threading the result of the test
--   function as long as it returns Just.
spanMaybe :: FactorialMonoid m => s -> (s -> m -> Maybe s) -> m -> (m, m, s)

-- | Strict version of spanMaybe.
spanMaybe' :: FactorialMonoid m => s -> (s -> m -> Maybe s) -> m -> (m, m, s)

-- | Like splitAt from Data.List on the list of prime
--   factors.
splitAt :: FactorialMonoid m => Int -> m -> (m, m)

-- | Equivalent to drop from Data.List.
drop :: FactorialMonoid m => Int -> m -> m

-- | Equivalent to take from Data.List.
take :: FactorialMonoid m => Int -> m -> m

-- | Deprecated: Use Data.Semigroup.Factorial.StableFactorial
--   instead.
type StableFactorialMonoid m = (StableFactorial m, FactorialMonoid m, PositiveMonoid m)
instance Data.Monoid.Factorial.FactorialMonoid Data.ByteString.Lazy.Internal.ByteString
instance Data.Monoid.Factorial.FactorialMonoid Data.ByteString.Internal.Type.ByteString
instance Data.Monoid.Factorial.FactorialMonoid a => Data.Monoid.Factorial.FactorialMonoid (GHC.Internal.Data.Functor.Const.Const a b)
instance Data.Monoid.Factorial.FactorialMonoid a => Data.Monoid.Factorial.FactorialMonoid (GHC.Internal.Data.Semigroup.Internal.Dual a)
instance Data.Monoid.Factorial.FactorialMonoid a => Data.Monoid.Factorial.FactorialMonoid (GHC.Internal.Data.Functor.Identity.Identity a)
instance Data.Monoid.Factorial.FactorialMonoid (Data.IntMap.Internal.IntMap a)
instance Data.Monoid.Factorial.FactorialMonoid Data.IntSet.Internal.IntSet
instance Data.Monoid.Factorial.FactorialMonoid [x]
instance GHC.Classes.Ord k => Data.Monoid.Factorial.FactorialMonoid (Data.Map.Internal.Map k v)
instance Data.Monoid.Factorial.FactorialMonoid a => Data.Monoid.Factorial.FactorialMonoid (GHC.Internal.Maybe.Maybe a)
instance GHC.Internal.Real.Integral a => Data.Monoid.Factorial.FactorialMonoid (GHC.Internal.Data.Semigroup.Internal.Product a)
instance Data.Monoid.Factorial.FactorialMonoid (Data.Sequence.Internal.Seq a)
instance GHC.Classes.Ord a => Data.Monoid.Factorial.FactorialMonoid (Data.Set.Internal.Set a)
instance (GHC.Internal.Real.Integral a, GHC.Classes.Eq a) => Data.Monoid.Factorial.FactorialMonoid (GHC.Internal.Data.Semigroup.Internal.Sum a)
instance Data.Monoid.Factorial.FactorialMonoid Data.Text.Internal.Lazy.Text
instance Data.Monoid.Factorial.FactorialMonoid Data.Text.Internal.Text
instance (Data.Monoid.Factorial.FactorialMonoid a, Data.Monoid.Factorial.FactorialMonoid b) => Data.Monoid.Factorial.FactorialMonoid (a, b)
instance (Data.Monoid.Factorial.FactorialMonoid a, Data.Monoid.Factorial.FactorialMonoid b, Data.Monoid.Factorial.FactorialMonoid c) => Data.Monoid.Factorial.FactorialMonoid (a, b, c)
instance (Data.Monoid.Factorial.FactorialMonoid a, Data.Monoid.Factorial.FactorialMonoid b, Data.Monoid.Factorial.FactorialMonoid c, Data.Monoid.Factorial.FactorialMonoid d) => Data.Monoid.Factorial.FactorialMonoid (a, b, c, d)
instance Data.Monoid.Factorial.FactorialMonoid ()
instance Data.Monoid.Factorial.FactorialMonoid (Data.Vector.Vector a)

-- | This module defines the TextualMonoid class and several of its
--   instances.
module Data.Monoid.Textual

-- | The TextualMonoid class is an extension of
--   FactorialMonoid specialized for monoids that can contain
--   characters. Its methods are generally equivalent to their namesake
--   functions from Data.List and Data.Text, and they satisfy
--   the following laws:
--   
--   
--   unfoldr splitCharacterPrefix . fromString == id
--   splitCharacterPrefix . primePrefix == fmap (\(c, t)-> (c, mempty)) . splitCharacterPrefix
--   
--   map f . fromString == fromString . List.map f
--   concatMap (fromString . f) . fromString == fromString . List.concatMap f
--   
--   foldl  ft fc a . fromString == List.foldl  fc a
--   foldr  ft fc a . fromString == List.foldr  fc a
--   foldl' ft fc a . fromString == List.foldl' fc a
--   
--   scanl f c . fromString == fromString . List.scanl f c
--   scanr f c . fromString == fromString . List.scanr f c
--   mapAccumL f a . fromString == fmap fromString . List.mapAccumL f a
--   mapAccumL f a . fromString == fmap fromString . List.mapAccumL f a
--   
--   takeWhile pt pc . fromString == fromString . takeWhile pc
--   dropWhile pt pc . fromString == fromString . dropWhile pc
--   
--   mconcat . intersperse (singleton c) . split (== c) == id
--   find p . fromString == List.find p
--   elem c . fromString == List.elem c
--   
--   
--   A TextualMonoid may contain non-character data insterspersed
--   between its characters. Every class method that returns a modified
--   TextualMonoid instance generally preserves this non-character
--   data. Methods like foldr can access both the non-character and
--   character data and expect two arguments for the two purposes. For each
--   of these methods there is also a simplified version with underscore in
--   name (like foldr_) that ignores the non-character data.
--   
--   All of the following expressions are identities:
--   
--   
--   map id
--   concatMap singleton
--   foldl  (<>) (\a c-> a <> singleton c) mempty
--   foldr  (<>) ((<>) . singleton) mempty
--   foldl' (<>) (\a c-> a <> singleton c) mempty
--   scanl1 (const id)
--   scanr1 const
--   uncurry (mapAccumL (,))
--   uncurry (mapAccumR (,))
--   takeWhile (const True) (const True)
--   dropWhile (const False) (const False)
--   toString undefined . fromString
--   toText undefined . fromText
--   
class (IsString t, LeftReductive t, LeftGCDMonoid t, FactorialMonoid t) => TextualMonoid t

-- | Contructs a new data type instance Like fromString, but from a
--   Text input instead of String.
--   
--   
--   fromText == fromString . Text.unpack
--   
fromText :: TextualMonoid t => Text -> t

-- | Creates a prime monoid containing a single character.
--   
--   
--   singleton c == fromString [c]
--   
singleton :: TextualMonoid t => Char -> t

-- | Specialized version of splitPrimePrefix. Every prime factor of
--   a textual monoid must consist of a single character or no character at
--   all.
splitCharacterPrefix :: TextualMonoid t => t -> Maybe (Char, t)

-- | Extracts a single character that prefixes the monoid, if the monoid
--   begins with a character. Otherwise returns Nothing.
--   
--   
--   characterPrefix == fmap fst . splitCharacterPrefix
--   
characterPrefix :: TextualMonoid t => t -> Maybe Char

-- | Equivalent to map from Data.List with a Char ->
--   Char function. Preserves all non-character data.
--   
--   
--   map f == concatMap (singleton . f)
--   
map :: TextualMonoid t => (Char -> Char) -> t -> t

-- | Equivalent to concatMap from Data.List with a Char
--   -> String function. Preserves all non-character data.
concatMap :: TextualMonoid t => (Char -> t) -> t -> t

-- | Returns the list of characters the monoid contains, once the argument
--   function converts all its non-character factors into characters.
toString :: TextualMonoid t => (t -> String) -> t -> String

-- | Converts the monoid into Text, given a function to convert the
--   non-character factors into chunks of Text.
toText :: TextualMonoid t => (t -> Text) -> t -> Text

-- | Equivalent to any from Data.List. Ignores all
--   non-character data.
any :: TextualMonoid t => (Char -> Bool) -> t -> Bool

-- | Equivalent to all from Data.List. Ignores all
--   non-character data.
all :: TextualMonoid t => (Char -> Bool) -> t -> Bool

-- | The first argument folds over the non-character prime factors, the
--   second over characters. Otherwise equivalent to foldl from
--   Data.List.
foldl :: TextualMonoid t => (a -> t -> a) -> (a -> Char -> a) -> a -> t -> a

-- | Strict version of foldl.
foldl' :: TextualMonoid t => (a -> t -> a) -> (a -> Char -> a) -> a -> t -> a

-- | The first argument folds over the non-character prime factors, the
--   second over characters. Otherwise equivalent to 'List.foldl'' from
--   Data.List.
foldr :: TextualMonoid t => (t -> a -> a) -> (Char -> a -> a) -> a -> t -> a

-- | Equivalent to scanl from Data.List when applied to a
--   String, but preserves all non-character data.
scanl :: TextualMonoid t => (Char -> Char -> Char) -> Char -> t -> t

-- | Equivalent to scanl1 from Data.List when applied to a
--   String, but preserves all non-character data.
--   
--   
--   scanl f c == scanl1 f . (singleton c <>)
--   
scanl1 :: TextualMonoid t => (Char -> Char -> Char) -> t -> t

-- | Equivalent to scanr from Data.List when applied to a
--   String, but preserves all non-character data.
scanr :: TextualMonoid t => (Char -> Char -> Char) -> Char -> t -> t

-- | Equivalent to scanr1 from Data.List when applied to a
--   String, but preserves all non-character data.
--   
--   
--   scanr f c == scanr1 f . (<> singleton c)
--   
scanr1 :: TextualMonoid t => (Char -> Char -> Char) -> t -> t

-- | Equivalent to mapAccumL from Data.List when applied to a
--   String, but preserves all non-character data.
mapAccumL :: TextualMonoid t => (a -> Char -> (a, Char)) -> a -> t -> (a, t)

-- | Equivalent to mapAccumR from Data.List when applied to a
--   String, but preserves all non-character data.
mapAccumR :: TextualMonoid t => (a -> Char -> (a, Char)) -> a -> t -> (a, t)

-- | The first predicate tests the non-character data, the second one the
--   characters. Otherwise equivalent to takeWhile from
--   Data.List when applied to a String.
takeWhile :: TextualMonoid t => (t -> Bool) -> (Char -> Bool) -> t -> t

-- | The first predicate tests the non-character data, the second one the
--   characters. Otherwise equivalent to dropWhile from
--   Data.List when applied to a String.
dropWhile :: TextualMonoid t => (t -> Bool) -> (Char -> Bool) -> t -> t

-- | 'break pt pc' is equivalent to span (not . pt) (not . pc).
break :: TextualMonoid t => (t -> Bool) -> (Char -> Bool) -> t -> (t, t)

-- | 'span pt pc t' is equivalent to (takeWhile pt pc t, dropWhile pt
--   pc t).
span :: TextualMonoid t => (t -> Bool) -> (Char -> Bool) -> t -> (t, t)

-- | A stateful variant of span, threading the result of the test
--   function as long as it returns Just.
spanMaybe :: TextualMonoid t => s -> (s -> t -> Maybe s) -> (s -> Char -> Maybe s) -> t -> (t, t, s)

-- | Strict version of spanMaybe.
spanMaybe' :: TextualMonoid t => s -> (s -> t -> Maybe s) -> (s -> Char -> Maybe s) -> t -> (t, t, s)

-- | Splits the monoid into components delimited by character separators
--   satisfying the given predicate. The characters satisfying the
--   predicate are not a part of the result.
--   
--   
--   split p == Factorial.split (maybe False p . characterPrefix)
--   
split :: TextualMonoid t => (Char -> Bool) -> t -> [t]

-- | Like find from Data.List when applied to a
--   String. Ignores non-character data.
find :: TextualMonoid t => (Char -> Bool) -> t -> Maybe Char

-- | Like elem from Data.List when applied to a
--   String. Ignores non-character data.
elem :: TextualMonoid t => Char -> t -> Bool

-- | 
--   foldl_ = foldl const
--   
foldl_ :: TextualMonoid t => (a -> Char -> a) -> a -> t -> a
foldl_' :: TextualMonoid t => (a -> Char -> a) -> a -> t -> a
foldr_ :: TextualMonoid t => (Char -> a -> a) -> a -> t -> a

-- | 
--   takeWhile_ = takeWhile . const
--   
takeWhile_ :: TextualMonoid t => Bool -> (Char -> Bool) -> t -> t

-- | 
--   dropWhile_ = dropWhile . const
--   
dropWhile_ :: TextualMonoid t => Bool -> (Char -> Bool) -> t -> t

-- | 
--   break_ = break . const
--   
break_ :: TextualMonoid t => Bool -> (Char -> Bool) -> t -> (t, t)

-- | 
--   span_ = span . const
--   
span_ :: TextualMonoid t => Bool -> (Char -> Bool) -> t -> (t, t)

-- | 
--   spanMaybe_ s = spanMaybe s (const . Just)
--   
spanMaybe_ :: TextualMonoid t => s -> (s -> Char -> Maybe s) -> t -> (t, t, s)
spanMaybe_' :: TextualMonoid t => s -> (s -> Char -> Maybe s) -> t -> (t, t, s)
instance Data.Monoid.Textual.TextualMonoid GHC.Internal.Base.String
instance Data.Monoid.Textual.TextualMonoid (Data.Sequence.Internal.Seq GHC.Types.Char)
instance Data.Monoid.Textual.TextualMonoid Data.Text.Internal.Lazy.Text
instance Data.Monoid.Textual.TextualMonoid Data.Text.Internal.Text

-- | This module contains orphan IsString and TextualMonoid
--   instances of Vector Char.
module Data.Monoid.Instances.CharVector
instance GHC.Internal.Data.String.IsString (Data.Vector.Vector GHC.Types.Char)
instance Data.Monoid.Textual.TextualMonoid (Data.Vector.Vector GHC.Types.Char)

-- | This module defines the monoid transformer data type Stateful.
--   
--   
--   > let s = setState [4] $ pure "data" :: Stateful [Int] String
--   > s
--   Stateful ("data",[4])
--   > factors s
--   [Stateful ("d",[]),Stateful ("a",[]),Stateful ("t",[]),Stateful ("a",[]),Stateful ("",[4])]
--   
module Data.Monoid.Instances.Stateful

-- | Stateful a b is a wrapper around the Monoid
--   b that carries the state a along. The state type
--   a must be a monoid as well if Stateful is to be of any
--   use. In the FactorialMonoid and TextualMonoid class
--   instances, the monoid b has the priority and the state
--   a is left for the end.
newtype Stateful a b
Stateful :: (b, a) -> Stateful a b
extract :: Stateful a b -> b
state :: Stateful a b -> a
setState :: a -> Stateful a b -> Stateful a b
instance GHC.Internal.Base.Monoid a => GHC.Internal.Base.Applicative (Data.Monoid.Instances.Stateful.Stateful a)
instance (GHC.Internal.Data.Data.Data a, GHC.Internal.Data.Data.Data b) => GHC.Internal.Data.Data.Data (Data.Monoid.Instances.Stateful.Stateful a b)
instance (GHC.Classes.Eq b, GHC.Classes.Eq a) => GHC.Classes.Eq (Data.Monoid.Instances.Stateful.Stateful a b)
instance (Data.Monoid.Factorial.FactorialMonoid a, Data.Monoid.Factorial.FactorialMonoid b) => Data.Monoid.Factorial.FactorialMonoid (Data.Monoid.Instances.Stateful.Stateful a b)
instance (Data.Monoid.Factorial.FactorialMonoid a, Data.Monoid.Factorial.FactorialMonoid b) => Data.Semigroup.Factorial.Factorial (Data.Monoid.Instances.Stateful.Stateful a b)
instance GHC.Internal.Base.Functor (Data.Monoid.Instances.Stateful.Stateful a)
instance (GHC.Internal.Base.Monoid a, GHC.Internal.Data.String.IsString b) => GHC.Internal.Data.String.IsString (Data.Monoid.Instances.Stateful.Stateful a b)
instance (Data.Monoid.GCD.LeftGCDMonoid a, Data.Monoid.GCD.LeftGCDMonoid b) => Data.Monoid.GCD.LeftGCDMonoid (Data.Monoid.Instances.Stateful.Stateful a b)
instance (Data.Semigroup.Cancellative.LeftReductive a, Data.Semigroup.Cancellative.LeftReductive b) => Data.Semigroup.Cancellative.LeftReductive (Data.Monoid.Instances.Stateful.Stateful a b)
instance (GHC.Internal.Base.Semigroup a, GHC.Internal.Base.Semigroup b, Data.Monoid.Null.MonoidNull a, Data.Monoid.Null.MonoidNull b) => Data.Monoid.Null.MonoidNull (Data.Monoid.Instances.Stateful.Stateful a b)
instance (GHC.Internal.Base.Semigroup a, GHC.Internal.Base.Semigroup b, GHC.Internal.Base.Monoid a, GHC.Internal.Base.Monoid b) => GHC.Internal.Base.Monoid (Data.Monoid.Instances.Stateful.Stateful a b)
instance (GHC.Classes.Ord b, GHC.Classes.Ord a) => GHC.Classes.Ord (Data.Monoid.Instances.Stateful.Stateful a b)
instance (GHC.Internal.Base.Semigroup a, GHC.Internal.Base.Semigroup b, Data.Monoid.Null.PositiveMonoid a, Data.Monoid.Null.PositiveMonoid b) => Data.Monoid.Null.PositiveMonoid (Data.Monoid.Instances.Stateful.Stateful a b)
instance (Data.Monoid.GCD.RightGCDMonoid a, Data.Monoid.GCD.RightGCDMonoid b) => Data.Monoid.GCD.RightGCDMonoid (Data.Monoid.Instances.Stateful.Stateful a b)
instance (Data.Semigroup.Cancellative.RightReductive a, Data.Semigroup.Cancellative.RightReductive b) => Data.Semigroup.Cancellative.RightReductive (Data.Monoid.Instances.Stateful.Stateful a b)
instance (GHC.Internal.Base.Semigroup a, GHC.Internal.Base.Semigroup b) => GHC.Internal.Base.Semigroup (Data.Monoid.Instances.Stateful.Stateful a b)
instance (GHC.Internal.Show.Show b, GHC.Internal.Show.Show a) => GHC.Internal.Show.Show (Data.Monoid.Instances.Stateful.Stateful a b)
instance (Data.Monoid.Factorial.FactorialMonoid a, Data.Monoid.Factorial.FactorialMonoid b, Data.Semigroup.Factorial.StableFactorial a, Data.Semigroup.Factorial.StableFactorial b) => Data.Semigroup.Factorial.StableFactorial (Data.Monoid.Instances.Stateful.Stateful a b)
instance (Data.Monoid.GCD.LeftGCDMonoid a, Data.Monoid.Factorial.FactorialMonoid a, Data.Monoid.Textual.TextualMonoid b) => Data.Monoid.Textual.TextualMonoid (Data.Monoid.Instances.Stateful.Stateful a b)

-- | This module defines the monoid transformer data type Shadowed.
module Data.Monoid.Instances.PrefixMemory

-- | Monoid transformer that keeps track of the former prefix of its
--   content. All functions that return a suffix of their argument,
--   such as stripPrefix or commonSuffix, preserve the
--   discarded prefix.
data Shadowed m

-- | The constructor of a Shadowed monoid, with the initial
--   prefix = null
shadowed :: Monoid m => m -> Shadowed m

-- | the present value
content :: Shadowed m -> m

-- | used to precede the content but has been consumed
prefix :: Shadowed m -> m
instance GHC.Internal.Data.Data.Data m => GHC.Internal.Data.Data.Data (Data.Monoid.Instances.PrefixMemory.Shadowed m)
instance GHC.Classes.Eq m => GHC.Classes.Eq (Data.Monoid.Instances.PrefixMemory.Shadowed m)
instance (Data.Semigroup.Factorial.StableFactorial m, Data.Monoid.Factorial.FactorialMonoid m) => Data.Monoid.Factorial.FactorialMonoid (Data.Monoid.Instances.PrefixMemory.Shadowed m)
instance (Data.Monoid.Factorial.FactorialMonoid m, Data.Semigroup.Factorial.StableFactorial m) => Data.Semigroup.Factorial.Factorial (Data.Monoid.Instances.PrefixMemory.Shadowed m)
instance (GHC.Internal.Base.Monoid m, GHC.Internal.Data.String.IsString m) => GHC.Internal.Data.String.IsString (Data.Monoid.Instances.PrefixMemory.Shadowed m)
instance (GHC.Classes.Eq m, Data.Semigroup.Factorial.StableFactorial m, Data.Monoid.Factorial.FactorialMonoid m, Data.Monoid.GCD.LeftGCDMonoid m) => Data.Monoid.GCD.LeftGCDMonoid (Data.Monoid.Instances.PrefixMemory.Shadowed m)
instance (Data.Monoid.Null.MonoidNull m, Data.Semigroup.Factorial.StableFactorial m, Data.Semigroup.Cancellative.LeftReductive m) => Data.Semigroup.Cancellative.LeftReductive (Data.Monoid.Instances.PrefixMemory.Shadowed m)
instance (Data.Monoid.Null.MonoidNull m, Data.Semigroup.Factorial.StableFactorial m) => Data.Monoid.Null.MonoidNull (Data.Monoid.Instances.PrefixMemory.Shadowed m)
instance (Data.Monoid.Null.MonoidNull m, Data.Semigroup.Factorial.StableFactorial m) => GHC.Internal.Base.Monoid (Data.Monoid.Instances.PrefixMemory.Shadowed m)
instance GHC.Classes.Ord m => GHC.Classes.Ord (Data.Monoid.Instances.PrefixMemory.Shadowed m)
instance (Data.Monoid.Null.PositiveMonoid m, Data.Semigroup.Factorial.StableFactorial m) => Data.Monoid.Null.PositiveMonoid (Data.Monoid.Instances.PrefixMemory.Shadowed m)
instance (Data.Semigroup.Factorial.StableFactorial m, Data.Monoid.Factorial.FactorialMonoid m, Data.Monoid.GCD.RightGCDMonoid m) => Data.Monoid.GCD.RightGCDMonoid (Data.Monoid.Instances.PrefixMemory.Shadowed m)
instance (Data.Semigroup.Factorial.StableFactorial m, Data.Monoid.Factorial.FactorialMonoid m, Data.Semigroup.Cancellative.RightReductive m) => Data.Semigroup.Cancellative.RightReductive (Data.Monoid.Instances.PrefixMemory.Shadowed m)
instance (Data.Monoid.Null.MonoidNull m, Data.Semigroup.Factorial.StableFactorial m) => GHC.Internal.Base.Semigroup (Data.Monoid.Instances.PrefixMemory.Shadowed m)
instance (Data.Monoid.Null.MonoidNull m, GHC.Internal.Show.Show m) => GHC.Internal.Show.Show (Data.Monoid.Instances.PrefixMemory.Shadowed m)
instance (Data.Semigroup.Factorial.StableFactorial m, Data.Monoid.Factorial.FactorialMonoid m) => Data.Semigroup.Factorial.StableFactorial (Data.Monoid.Instances.PrefixMemory.Shadowed m)
instance (GHC.Classes.Eq m, Data.Semigroup.Factorial.StableFactorial m, Data.Monoid.Textual.TextualMonoid m) => Data.Monoid.Textual.TextualMonoid (Data.Monoid.Instances.PrefixMemory.Shadowed m)

-- | This module defines two monoid transformer data types,
--   OffsetPositioned and LinePositioned. Both data types add
--   a notion of the current position to their base monoid. In case of
--   OffsetPositioned, the current position is a simple integer
--   offset from the beginning of the monoid, and it can be applied to any
--   StableFactorial. The base monoid of LinePositioned must
--   be a TextualMonoid, but for the price it will keep track of the
--   current line and column numbers as well.
--   
--   Line number is zero-based, column one-based:
--   
--   
--   > let p = pure "abcd\nefgh\nijkl\nmnop\n" :: LinePositioned String
--   > p
--   "abcd\nefgh\nijkl\nmnop\n"
--   > Data.Monoid.Factorial.drop 13 p
--   Line 2, column 4: "l\nmnop\n"
--   
module Data.Monoid.Instances.Positioned
data OffsetPositioned m
data LinePositioned m
extract :: Positioned p => p a -> a
position :: Positioned p => p a -> Int

-- | the current line
line :: LinePositioned m -> Int

-- | the current column
column :: LinePositioned m -> Int
instance GHC.Internal.Base.Applicative Data.Monoid.Instances.Positioned.LinePositioned
instance GHC.Internal.Base.Applicative Data.Monoid.Instances.Positioned.OffsetPositioned
instance GHC.Internal.Data.Data.Data m => GHC.Internal.Data.Data.Data (Data.Monoid.Instances.Positioned.LinePositioned m)
instance GHC.Internal.Data.Data.Data m => GHC.Internal.Data.Data.Data (Data.Monoid.Instances.Positioned.OffsetPositioned m)
instance GHC.Classes.Eq m => GHC.Classes.Eq (Data.Monoid.Instances.Positioned.LinePositioned m)
instance GHC.Classes.Eq m => GHC.Classes.Eq (Data.Monoid.Instances.Positioned.OffsetPositioned m)
instance (Data.Semigroup.Factorial.StableFactorial m, Data.Monoid.Textual.TextualMonoid m) => Data.Monoid.Factorial.FactorialMonoid (Data.Monoid.Instances.Positioned.LinePositioned m)
instance (Data.Semigroup.Factorial.StableFactorial m, Data.Monoid.Factorial.FactorialMonoid m) => Data.Monoid.Factorial.FactorialMonoid (Data.Monoid.Instances.Positioned.OffsetPositioned m)
instance (Data.Semigroup.Factorial.StableFactorial m, Data.Monoid.Textual.TextualMonoid m) => Data.Semigroup.Factorial.Factorial (Data.Monoid.Instances.Positioned.LinePositioned m)
instance Data.Semigroup.Factorial.StableFactorial m => Data.Semigroup.Factorial.Factorial (Data.Monoid.Instances.Positioned.OffsetPositioned m)
instance GHC.Internal.Base.Functor Data.Monoid.Instances.Positioned.LinePositioned
instance GHC.Internal.Base.Functor Data.Monoid.Instances.Positioned.OffsetPositioned
instance GHC.Internal.Data.String.IsString m => GHC.Internal.Data.String.IsString (Data.Monoid.Instances.Positioned.LinePositioned m)
instance GHC.Internal.Data.String.IsString m => GHC.Internal.Data.String.IsString (Data.Monoid.Instances.Positioned.OffsetPositioned m)
instance (Data.Semigroup.Factorial.StableFactorial m, Data.Monoid.Textual.TextualMonoid m, Data.Monoid.GCD.LeftGCDMonoid m) => Data.Monoid.GCD.LeftGCDMonoid (Data.Monoid.Instances.Positioned.LinePositioned m)
instance (Data.Semigroup.Factorial.StableFactorial m, Data.Monoid.Factorial.FactorialMonoid m, Data.Monoid.GCD.LeftGCDMonoid m) => Data.Monoid.GCD.LeftGCDMonoid (Data.Monoid.Instances.Positioned.OffsetPositioned m)
instance (Data.Semigroup.Factorial.StableFactorial m, Data.Monoid.Textual.TextualMonoid m) => Data.Semigroup.Cancellative.LeftReductive (Data.Monoid.Instances.Positioned.LinePositioned m)
instance (Data.Semigroup.Factorial.StableFactorial m, Data.Semigroup.Cancellative.LeftReductive m) => Data.Semigroup.Cancellative.LeftReductive (Data.Monoid.Instances.Positioned.OffsetPositioned m)
instance (Data.Semigroup.Factorial.StableFactorial m, Data.Monoid.Textual.TextualMonoid m, Data.Monoid.Null.MonoidNull m) => Data.Monoid.Null.MonoidNull (Data.Monoid.Instances.Positioned.LinePositioned m)
instance (Data.Semigroup.Factorial.StableFactorial m, Data.Monoid.Factorial.FactorialMonoid m) => Data.Monoid.Null.MonoidNull (Data.Monoid.Instances.Positioned.OffsetPositioned m)
instance (Data.Semigroup.Factorial.StableFactorial m, Data.Monoid.Textual.TextualMonoid m) => GHC.Internal.Base.Monoid (Data.Monoid.Instances.Positioned.LinePositioned m)
instance (Data.Monoid.Factorial.FactorialMonoid m, Data.Semigroup.Factorial.StableFactorial m) => GHC.Internal.Base.Monoid (Data.Monoid.Instances.Positioned.OffsetPositioned m)
instance GHC.Classes.Ord m => GHC.Classes.Ord (Data.Monoid.Instances.Positioned.LinePositioned m)
instance GHC.Classes.Ord m => GHC.Classes.Ord (Data.Monoid.Instances.Positioned.OffsetPositioned m)
instance Data.Monoid.Instances.Positioned.Positioned Data.Monoid.Instances.Positioned.LinePositioned
instance Data.Monoid.Instances.Positioned.Positioned Data.Monoid.Instances.Positioned.OffsetPositioned
instance (Data.Semigroup.Factorial.StableFactorial m, Data.Monoid.Textual.TextualMonoid m) => Data.Monoid.Null.PositiveMonoid (Data.Monoid.Instances.Positioned.LinePositioned m)
instance (Data.Semigroup.Factorial.StableFactorial m, Data.Monoid.Factorial.FactorialMonoid m) => Data.Monoid.Null.PositiveMonoid (Data.Monoid.Instances.Positioned.OffsetPositioned m)
instance (Data.Semigroup.Factorial.StableFactorial m, Data.Monoid.Textual.TextualMonoid m, Data.Monoid.GCD.RightGCDMonoid m) => Data.Monoid.GCD.RightGCDMonoid (Data.Monoid.Instances.Positioned.LinePositioned m)
instance (Data.Semigroup.Factorial.StableFactorial m, Data.Monoid.Factorial.FactorialMonoid m, Data.Monoid.GCD.RightGCDMonoid m) => Data.Monoid.GCD.RightGCDMonoid (Data.Monoid.Instances.Positioned.OffsetPositioned m)
instance (Data.Semigroup.Factorial.StableFactorial m, Data.Monoid.Textual.TextualMonoid m, Data.Semigroup.Cancellative.RightReductive m) => Data.Semigroup.Cancellative.RightReductive (Data.Monoid.Instances.Positioned.LinePositioned m)
instance (Data.Semigroup.Factorial.StableFactorial m, Data.Monoid.Factorial.FactorialMonoid m, Data.Semigroup.Cancellative.RightReductive m) => Data.Semigroup.Cancellative.RightReductive (Data.Monoid.Instances.Positioned.OffsetPositioned m)
instance (Data.Semigroup.Factorial.StableFactorial m, Data.Monoid.Textual.TextualMonoid m) => GHC.Internal.Base.Semigroup (Data.Monoid.Instances.Positioned.LinePositioned m)
instance Data.Semigroup.Factorial.StableFactorial m => GHC.Internal.Base.Semigroup (Data.Monoid.Instances.Positioned.OffsetPositioned m)
instance GHC.Internal.Show.Show m => GHC.Internal.Show.Show (Data.Monoid.Instances.Positioned.LinePositioned m)
instance GHC.Internal.Show.Show m => GHC.Internal.Show.Show (Data.Monoid.Instances.Positioned.OffsetPositioned m)
instance (Data.Semigroup.Factorial.StableFactorial m, Data.Monoid.Textual.TextualMonoid m) => Data.Semigroup.Factorial.StableFactorial (Data.Monoid.Instances.Positioned.LinePositioned m)
instance Data.Semigroup.Factorial.StableFactorial m => Data.Semigroup.Factorial.StableFactorial (Data.Monoid.Instances.Positioned.OffsetPositioned m)
instance (Data.Semigroup.Factorial.StableFactorial m, Data.Monoid.Textual.TextualMonoid m) => Data.Monoid.Textual.TextualMonoid (Data.Monoid.Instances.Positioned.LinePositioned m)
instance (Data.Semigroup.Factorial.StableFactorial m, Data.Monoid.Textual.TextualMonoid m) => Data.Monoid.Textual.TextualMonoid (Data.Monoid.Instances.Positioned.OffsetPositioned m)

-- | This module defines the monoid transformer data type Measured.
module Data.Monoid.Instances.Measured

-- | Measured a is a wrapper around the
--   FactorialMonoid a that memoizes the monoid's
--   length so it becomes a constant-time operation. The parameter
--   is restricted to the StableFactorial class, which guarantees
--   that length (a <> b) == length a +
--   length b.
data Measured a

-- | Create a new Measured value.
measure :: Factorial a => a -> Measured a
extract :: Measured a -> a
instance GHC.Internal.Data.Data.Data a => GHC.Internal.Data.Data.Data (Data.Monoid.Instances.Measured.Measured a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Monoid.Instances.Measured.Measured a)
instance (Data.Semigroup.Factorial.StableFactorial a, Data.Monoid.Null.MonoidNull a) => Data.Semigroup.Factorial.Factorial (Data.Monoid.Instances.Measured.Measured a)
instance (Data.Semigroup.Factorial.StableFactorial a, Data.Monoid.Factorial.FactorialMonoid a) => Data.Monoid.Factorial.FactorialMonoid (Data.Monoid.Instances.Measured.Measured a)
instance (Data.Monoid.Factorial.FactorialMonoid a, GHC.Internal.Data.String.IsString a) => GHC.Internal.Data.String.IsString (Data.Monoid.Instances.Measured.Measured a)
instance (Data.Monoid.GCD.LeftGCDMonoid a, Data.Semigroup.Factorial.StableFactorial a) => Data.Monoid.GCD.LeftGCDMonoid (Data.Monoid.Instances.Measured.Measured a)
instance (Data.Semigroup.Cancellative.LeftReductive a, Data.Semigroup.Factorial.StableFactorial a) => Data.Semigroup.Cancellative.LeftReductive (Data.Monoid.Instances.Measured.Measured a)
instance (Data.Semigroup.Factorial.StableFactorial a, GHC.Internal.Base.Monoid a) => GHC.Internal.Base.Monoid (Data.Monoid.Instances.Measured.Measured a)
instance (Data.Semigroup.Factorial.StableFactorial a, GHC.Internal.Base.Monoid a) => Data.Monoid.Null.MonoidNull (Data.Monoid.Instances.Measured.Measured a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Monoid.Instances.Measured.Measured a)
instance (Data.Semigroup.Factorial.StableFactorial a, GHC.Internal.Base.Monoid a) => Data.Monoid.Null.PositiveMonoid (Data.Monoid.Instances.Measured.Measured a)
instance (Data.Monoid.GCD.RightGCDMonoid a, Data.Semigroup.Factorial.StableFactorial a) => Data.Monoid.GCD.RightGCDMonoid (Data.Monoid.Instances.Measured.Measured a)
instance (Data.Semigroup.Cancellative.RightReductive a, Data.Semigroup.Factorial.StableFactorial a) => Data.Semigroup.Cancellative.RightReductive (Data.Monoid.Instances.Measured.Measured a)
instance Data.Semigroup.Factorial.StableFactorial a => GHC.Internal.Base.Semigroup (Data.Monoid.Instances.Measured.Measured a)
instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Data.Monoid.Instances.Measured.Measured a)
instance (Data.Semigroup.Factorial.StableFactorial a, Data.Monoid.Null.MonoidNull a) => Data.Semigroup.Factorial.StableFactorial (Data.Monoid.Instances.Measured.Measured a)
instance (GHC.Classes.Eq a, Data.Semigroup.Factorial.StableFactorial a, Data.Monoid.Textual.TextualMonoid a) => Data.Monoid.Textual.TextualMonoid (Data.Monoid.Instances.Measured.Measured a)

-- | This module defines the monoid transformer data type Concat.
module Data.Monoid.Instances.Concat

-- | Concat is a transparent monoid transformer. The
--   behaviour of the Concat a instances of monoid
--   subclasses is identical to the behaviour of their a
--   instances, up to the pure isomorphism.
--   
--   The only purpose of Concat then is to change the performance
--   characteristics of various operations. Most importantly, injecting a
--   monoid into Concat has the effect of making mappend a
--   constant-time operation. The splitPrimePrefix and
--   splitPrimeSuffix operations are amortized to constant time,
--   provided that only one or the other is used. Using both operations
--   alternately will trigger the worst-case behaviour of O(n).
data Concat a

-- | Deprecated: Concat is not wrapping Seq any more, don't use
--   concatenate nor extract.
concatenate :: PositiveMonoid a => Seq a -> Concat a

-- | Deprecated: Concat is not wrapping Seq any more, don't use
--   concatenate nor extract.
extract :: Concat a -> Seq a
force :: Semigroup a => Concat a -> a
instance GHC.Internal.Base.Applicative Data.Monoid.Instances.Concat.Concat
instance GHC.Internal.Data.Data.Data a => GHC.Internal.Data.Data.Data (Data.Monoid.Instances.Concat.Concat a)
instance (GHC.Classes.Eq a, GHC.Internal.Base.Semigroup a) => GHC.Classes.Eq (Data.Monoid.Instances.Concat.Concat a)
instance (Data.Semigroup.Factorial.Factorial a, Data.Monoid.Null.PositiveMonoid a) => Data.Semigroup.Factorial.Factorial (Data.Monoid.Instances.Concat.Concat a)
instance (Data.Monoid.Factorial.FactorialMonoid a, Data.Monoid.Null.PositiveMonoid a) => Data.Monoid.Factorial.FactorialMonoid (Data.Monoid.Instances.Concat.Concat a)
instance GHC.Internal.Data.Foldable.Foldable Data.Monoid.Instances.Concat.Concat
instance GHC.Internal.Base.Functor Data.Monoid.Instances.Concat.Concat
instance GHC.Internal.Data.String.IsString a => GHC.Internal.Data.String.IsString (Data.Monoid.Instances.Concat.Concat a)
instance (Data.Monoid.GCD.LeftGCDMonoid a, Data.Semigroup.Factorial.StableFactorial a, Data.Monoid.Null.PositiveMonoid a) => Data.Monoid.GCD.LeftGCDMonoid (Data.Monoid.Instances.Concat.Concat a)
instance (Data.Semigroup.Cancellative.LeftReductive a, Data.Semigroup.Factorial.StableFactorial a, Data.Monoid.Null.PositiveMonoid a) => Data.Semigroup.Cancellative.LeftReductive (Data.Monoid.Instances.Concat.Concat a)
instance Data.Monoid.Null.PositiveMonoid a => GHC.Internal.Base.Monoid (Data.Monoid.Instances.Concat.Concat a)
instance Data.Monoid.Null.PositiveMonoid a => Data.Monoid.Null.MonoidNull (Data.Monoid.Instances.Concat.Concat a)
instance (GHC.Classes.Ord a, GHC.Internal.Base.Semigroup a) => GHC.Classes.Ord (Data.Monoid.Instances.Concat.Concat a)
instance Data.Monoid.Null.PositiveMonoid a => Data.Monoid.Null.PositiveMonoid (Data.Monoid.Instances.Concat.Concat a)
instance (Data.Monoid.GCD.RightGCDMonoid a, Data.Semigroup.Factorial.StableFactorial a, Data.Monoid.Null.PositiveMonoid a) => Data.Monoid.GCD.RightGCDMonoid (Data.Monoid.Instances.Concat.Concat a)
instance (Data.Semigroup.Cancellative.RightReductive a, Data.Semigroup.Factorial.StableFactorial a, Data.Monoid.Null.PositiveMonoid a) => Data.Semigroup.Cancellative.RightReductive (Data.Monoid.Instances.Concat.Concat a)
instance Data.Monoid.Null.PositiveMonoid a => GHC.Internal.Base.Semigroup (Data.Monoid.Instances.Concat.Concat a)
instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Data.Monoid.Instances.Concat.Concat a)
instance (Data.Semigroup.Factorial.Factorial a, Data.Monoid.Null.PositiveMonoid a) => Data.Semigroup.Factorial.StableFactorial (Data.Monoid.Instances.Concat.Concat a)
instance (GHC.Classes.Eq a, Data.Monoid.Textual.TextualMonoid a, Data.Semigroup.Factorial.StableFactorial a, Data.Monoid.Null.PositiveMonoid a) => Data.Monoid.Textual.TextualMonoid (Data.Monoid.Instances.Concat.Concat a)

-- | This module defines the ByteStringUTF8 newtype wrapper around
--   ByteString, together with its TextualMonoid instance.
--   The FactorialMonoid instance of a wrapped ByteStringUTF8
--   value differs from the original ByteString: the prime
--   factors of the original value are its bytes, and for the
--   wrapped value the prime factors are its valid UTF8 byte
--   sequences. The following example session demonstrates the
--   relationship:
--   
--   
--   > let utf8@(ByteStringUTF8 bs) = fromString "E=mc\xb2"
--   > bs
--   "E=mc\194\178"
--   > factors bs
--   ["E","=","m","c","\194","\178"]
--   > utf8
--   "E=mc²"
--   > factors utf8
--   ["E","=","m","c","²"]
--   
--   
--   The TextualMonoid instance follows the same logic, but it also
--   decodes all valid UTF8 sequences into characters. Any invalid UTF8
--   byte sequence from the original ByteString is preserved as a
--   single prime factor:
--   
--   
--   > let utf8'@(ByteStringUTF8 bs') = ByteStringUTF8 (Data.ByteString.map pred bs)
--   > bs'
--   "D<lb\193\177"
--   > factors bs'
--   ["D","<","l","b","\193","\177"]
--   > utf8'
--   "D<lb\[193,177]"
--   > factors utf8'
--   ["D","<","l","b","\[193,177]"]
--   
module Data.Monoid.Instances.ByteString.UTF8
newtype ByteStringUTF8
ByteStringUTF8 :: ByteString -> ByteStringUTF8

-- | Takes a raw ByteString chunk and returns a pair of
--   ByteStringUTF8 decoding the prefix of the chunk and the
--   remaining suffix that is either null or contains the incomplete last
--   character of the chunk.
decode :: ByteString -> (ByteStringUTF8, ByteString)
instance GHC.Internal.Data.Data.Data Data.Monoid.Instances.ByteString.UTF8.ByteStringUTF8
instance GHC.Classes.Eq Data.Monoid.Instances.ByteString.UTF8.ByteStringUTF8
instance Data.Semigroup.Factorial.Factorial Data.Monoid.Instances.ByteString.UTF8.ByteStringUTF8
instance Data.Monoid.Factorial.FactorialMonoid Data.Monoid.Instances.ByteString.UTF8.ByteStringUTF8
instance GHC.Internal.Data.String.IsString Data.Monoid.Instances.ByteString.UTF8.ByteStringUTF8
instance Data.Semigroup.Cancellative.LeftCancellative Data.Monoid.Instances.ByteString.UTF8.ByteStringUTF8
instance Data.Monoid.GCD.LeftGCDMonoid Data.Monoid.Instances.ByteString.UTF8.ByteStringUTF8
instance Data.Semigroup.Cancellative.LeftReductive Data.Monoid.Instances.ByteString.UTF8.ByteStringUTF8
instance GHC.Internal.Base.Monoid Data.Monoid.Instances.ByteString.UTF8.ByteStringUTF8
instance Data.Monoid.Null.MonoidNull Data.Monoid.Instances.ByteString.UTF8.ByteStringUTF8
instance GHC.Classes.Ord Data.Monoid.Instances.ByteString.UTF8.ByteStringUTF8
instance Data.Monoid.Null.PositiveMonoid Data.Monoid.Instances.ByteString.UTF8.ByteStringUTF8
instance GHC.Internal.Base.Semigroup Data.Monoid.Instances.ByteString.UTF8.ByteStringUTF8
instance GHC.Internal.Show.Show Data.Monoid.Instances.ByteString.UTF8.ByteStringUTF8
instance Data.Monoid.Textual.TextualMonoid Data.Monoid.Instances.ByteString.UTF8.ByteStringUTF8
