Hoogle Search

Within LTS Haskell 24.4 (ghc-9.10.2)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. type RightReductiveMonoid m = (Monoid m, RightReductive m)

    monoid-subclasses Data.Monoid.Cancellative

    No documentation available.

  2. class (Factorial m, MonoidNull m) => FactorialMonoid m

    monoid-subclasses 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.

  3. type StableFactorialMonoid m = (StableFactorial m, FactorialMonoid m, PositiveMonoid m)

    monoid-subclasses Data.Monoid.Factorial

    Deprecated: Use Data.Semigroup.Factorial.StableFactorial instead.

  4. class (LeftDistributiveGCDMonoid m, RightDistributiveGCDMonoid m, GCDMonoid m) => DistributiveGCDMonoid m

    monoid-subclasses Data.Monoid.GCD

    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
    

  5. class (Monoid m, Commutative m, Reductive m, LeftGCDMonoid m, RightGCDMonoid m, OverlappingGCDMonoid m) => GCDMonoid m

    monoid-subclasses 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)
    

  6. class LeftGCDMonoid m => LeftDistributiveGCDMonoid m

    monoid-subclasses Data.Monoid.GCD

    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
    

  7. class (Monoid m, LeftReductive m) => LeftGCDMonoid m

    monoid-subclasses Data.Monoid.GCD

    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)
    

  8. class (Monoid m, LeftReductive m, RightReductive m) => OverlappingGCDMonoid m

    monoid-subclasses Data.Monoid.GCD

    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
    

  9. class RightGCDMonoid m => RightDistributiveGCDMonoid m

    monoid-subclasses Data.Monoid.GCD

    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
    

  10. class (Monoid m, RightReductive m) => RightGCDMonoid m

    monoid-subclasses Data.Monoid.GCD

    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)
    

Page 9 of many | Previous | Next