Category

A class for categories. In mathematics, a category is defined as a collection of objects and a collection of morphisms between objects, together with an identity morphism id for every object and an operation (.) that composes compatible morphisms. This class is defined in an analogous way. The collection of morphisms is represented by a type parameter cat, which has kind k -> k -> Type for some kind variable k that represents the collection of objects; most of the time the choice of k will be Type.

Examples

As the method names suggest, there's a category of functions:
instance Category (->) where
id = \x -> x
f . g = \x -> f (g x)
Isomorphisms form a category as well:
data Iso a b = Iso (a -> b) (b -> a)

instance Category Iso where
id = Iso id id
Iso f1 g1 . Iso f2 g2 = Iso (f1 . f2) (g2 . g1)
Natural transformations are another important example:
newtype f ~> g = NatTransform (forall x. f x -> g x)

instance Category (~>) where
id = NatTransform id
NatTransform f . NatTransform g = NatTransform (f . g)
Using the TypeData language extension, we can also make a category where k isn't Type, but a custom kind Door instead:
type data Door = DoorOpen | DoorClosed

data Action (before :: Door) (after :: Door) where
DoNothing :: Action door door
OpenDoor :: Action start DoorClosed -> Action start DoorOpen
CloseDoor :: Action start DoorOpen -> Action start DoorClosed

instance Category Action where
id = DoNothing

DoNothing . action = action
OpenDoor rest . action = OpenDoor (rest . action)
CloseDoor rest . action = CloseDoor (rest . action)
A class for categories. Instances should satisfy the laws
  • Right identity f . id = f
  • Left identity id . f = f
  • Associativity f . (g . h) = (f . g) . h
Provides unicode general categories, which are typically connoted by \p{Ll} or \p{Modifier_Letter}. Lookups can be constructed using categories or individual character sets can be used directly. A case, _ and - insensitive lookup is provided by lookupCategory and can be used to provide behavior similar to that of Perl or PCRE.
A class for categories. Instances should satisfy the laws
  • Right identity f . id = f
  • Left identity id . f = f
  • Associativity f . (g . h) = (f . g) . h
In mathematics, a category is defined as a class of objects, plus a class of morphisms between those objects. In Haskell, one traditionally works in the category (->) (called Hask), in which any Haskell type is an object. But of course there are lots of useful categories where the objects are much more specific, e.g. vector spaces with linear maps as morphisms. The obvious way to express this in Haskell is as type class constraints, and the ConstraintKinds extension allows quantifying over such object classes. Like in Control.Category, "the category k" means actually k is the morphism type constructor. From a mathematician's point of view this may seem a bit strange way to define the category, but it just turns out to be quite convenient for practical purposes.
Categorisation of (some) notifications
CATEGORY All data elements with the same category (e.g., domain value) are highlighted and shown in the tooltip.
Information about a feed or entry category as per https://tools.ietf.org/html/rfc4287#section-4.2.2.
A class for categories. Instances should satisfy the laws
f . id  =  f  -- (right identity)
id . f  =  f  -- (left identity)
f . (g . h)  =  (f . g) . h  -- (associativity)
Represents the category hierarchy of a SKU. See: category smart constructor.
This is a JSON template for data related to individual game categories. See: category smart constructor.
Under which category in hackage should the generated bindings be listed.