Hoogle Search
Within LTS Haskell 24.40 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
-
Semigroupoids: Category sans id Provides a wide array of (semi)groupoids and operations for working with them. A Semigroupoid is a Category without the requirement of identity arrows for every object in the category. A Category is any Semigroupoid for which the Yoneda lemma holds. When working with comonads you often have the <*> portion of an Applicative, but not the pure. This was captured in Uustalu and Vene's "Essence of Dataflow Programming" in the form of the ComonadZip class in the days before Applicative. Apply provides a weaker invariant, but for the comonads used for data flow programming (found in the streams package), this invariant is preserved. Applicative function composition forms a semigroupoid. Similarly many structures are nearly a comonad, but not quite, for instance lists provide a reasonable extend operation in the form of tails, but do not always contain a value. We describe the relationships between the type classes defined in this package and those from base (and some from contravariant) in the diagram below. Thick-bordered nodes correspond to type classes defined in this package; thin-bordered ones correspond to type classes from elsewhere. Solid edges indicate a subclass relationship that actually exists; dashed edges indicate a subclass relationship that should exist, but currently doesn't. Apply, Bind, and Extend (not shown) give rise the Static, Kleisli and Cokleisli semigroupoids respectively. This lets us remove many of the restrictions from various monad transformers as in many cases the binding operation or <*> operation does not require them. Finally, to work with these weaker structures it is beneficial to have containers that can provide stronger guarantees about their contents, so versions of Traversable and Foldable that can be folded with just a Semigroup are added.
module Data.Functor.Contravariant.
Decide This module is only available if building with GHC 8.6 or later, or if the +contravariant cabal build flag is available.
class Contravariant f =>
Decide (f :: Type -> Type)semigroupoids Data.Functor.Contravariant.Decide The contravariant analogue of Alt. If one thinks of f a as a consumer of as, then decide allows one to handle the consumption of a value by choosing to handle it via exactly one of two independent consumers. It redirects the input completely into one of two consumers. decide takes the "decision" method and the two potential consumers, and returns the wrapped/combined consumer. Mathematically, a functor being an instance of Decide means that it is "semigroupoidal" with respect to the contravariant "either-based" Day convolution (data EitherDay f g a = forall b c. EitherDay (f b) (g c) (a -> Either b c)). That is, it is possible to define a function (f EitherDay f) a -> f a in a way that is associative.
decide :: Decide f => (a -> Either b c) -> f b -> f c -> f asemigroupoids Data.Functor.Contravariant.Decide Takes the "decision" method and the two potential consumers, and returns the wrapped/combined consumer.
decided :: Decide f => f b -> f c -> f (Either b c)semigroupoids Data.Functor.Contravariant.Decide For decided x y, the resulting f (Either b c) will direct Lefts to be consumed by x, and Rights to be consumed by y.
gdecide :: (Generic1 f, Decide (Rep1 f)) => (a -> Either b c) -> f b -> f c -> f asemigroupoids Data.Functor.Contravariant.Decide Generic decide. Caveats:
- Will not compile if f is a sum type.
- Will not compile if f contains fields that do not mention its type variable.
- -XDeriveGeneric is not smart enough to make instances where the type variable appears in negative position.
gdecided :: (Generic1 f, Decide (Rep1 f)) => f b -> f c -> f (Either b c)semigroupoids Data.Functor.Contravariant.Decide -
No documentation available.
class Semigroupoid k1 =>
Groupoid (k1 :: k -> k -> Type)semigroupoids Data.Groupoid semigroupoid with inverses. This technically should be a category with inverses, except we need to use Ob to define the valid objects for the category
-
A semigroupoid satisfies all of the requirements to be a Category except for the existence of identity arrows.