first-class-families-0.8.2.0: First-class type families

Safe Haskell | Safe-Inferred
Language | Haskell2010

Fcf.Class.Monoid

Contents

- Pure type families
- First-class families

Description

Semigroups and monoids.

Synopsis

- type family (x :: a) <> (y :: a) :: a
- type family MEmpty :: a
- data ((b :: a) .<> (c :: a)) (d :: a)
- data MEmpty_ (b :: a)

# Pure type families

Nicer to use when applied explicitly.

type family (x :: a) <> (y :: a) :: a Source #

Type-level semigroup composition `(`<>`)`.

#### Instances

Instances details

type 'EQ <> (b :: Ordering) Source # |
Instance details Defined in Fcf.Class.Monoid type 'EQ <> (b :: Ordering) = b
type 'GT <> (_b :: Ordering) Source # |
Instance details Defined in Fcf.Class.Monoid type 'GT <> (_b :: Ordering) = 'GT
type 'LT <> (_b :: Ordering) Source # |
Instance details Defined in Fcf.Class.Monoid type 'LT <> (_b :: Ordering) = 'LT
type (a :: Ordering) <> 'EQ Source # |
Instance details Defined in Fcf.Class.Monoid type (a :: Ordering) <> 'EQ = a
type (_a :: ()) <> (_b :: ()) Source # |
Instance details Defined in Fcf.Class.Monoid type (_a :: ()) <> (_b :: ()) = '()
type (x :: Symbol) <> (y :: Symbol) Source # | With base >= 4.10.0.0.
Instance details Defined in Fcf.Class.Monoid type (x :: Symbol) <> (y :: Symbol) = AppendSymbol x y
type ('All a :: All) <> ('All b :: All) Source # |
Instance details Defined in Fcf.Class.Monoid type ('All a :: All) <> ('All b :: All) = 'All (a && b)
type ('Any a :: Any) <> ('Any b :: Any) Source # |
Instance details Defined in Fcf.Class.Monoid type ('Any a :: Any) <> ('Any b :: Any) = 'Any (a || b)
type (a2 :: Maybe a1) <> ('Nothing :: Maybe a1) Source # |
Instance details Defined in Fcf.Class.Monoid type (a2 :: Maybe a1) <> ('Nothing :: Maybe a1) = a2
type ('Nothing :: Maybe a) <> (b :: Maybe a) Source # |
Instance details Defined in Fcf.Class.Monoid type ('Nothing :: Maybe a) <> (b :: Maybe a) = b
type ('[] :: [a]) <> (ys :: [a]) Source # |
Instance details Defined in Fcf.Class.Monoid type ('[] :: [a]) <> (ys :: [a]) = ys
type ('Endo f :: Endo a) <> ('Endo g :: Endo a) Source # |
Instance details Defined in Fcf.Class.Monoid.Types type ('Endo f :: Endo a) <> ('Endo g :: Endo a) = 'Endo (f <=< g)
type ('Just a2 :: Maybe a1) <> ('Just b :: Maybe a1) Source # |
Instance details Defined in Fcf.Class.Monoid type ('Just a2 :: Maybe a1) <> ('Just b :: Maybe a1) = 'Just (a2 <> b)
type (x ': xs :: [a]) <> (ys :: [a]) Source # |
Instance details Defined in Fcf.Class.Monoid type (x ': xs :: [a]) <> (ys :: [a]) = x ': (xs <> ys)
type ('(a1, a2) :: (k1, k2)) <> ('(b1, b2) :: (k1, k2)) Source # |
Instance details Defined in Fcf.Class.Monoid type ('(a1, a2) :: (k1, k2)) <> ('(b1, b2) :: (k1, k2)) = '(a1 <> b1, a2 <> b2)
type ('(a1, a2, a3) :: (k1, k2, k3)) <> ('(b1, b2, b3) :: (k1, k2, k3)) Source # |
Instance details Defined in Fcf.Class.Monoid type ('(a1, a2, a3) :: (k1, k2, k3)) <> ('(b1, b2, b3) :: (k1, k2, k3)) = '(a1 <> b1, a2 <> b2, a3 <> b3)

type family MEmpty :: a Source #

Type-level monoid identity `mempty`.

### Examples

Expand

    >>> :kind! LT <> MEmpty
    LT <> MEmpty :: Ordering
    = LT

    >>> :kind! MEmpty <> '(EQ, [1, 2])
    MEmpty <> '(EQ, [1, 2]) :: (Ordering, [Natural])
    = '(EQ, [1, 2])

    >>> :kind! '(GT, Just '()) <> MEmpty
    '(GT, Just '()) <> MEmpty :: (Ordering, Maybe ())
    = '(GT, Just '())

#### Instances

Instances details

type MEmpty Source # |
Instance details Defined in Fcf.Class.Monoid type MEmpty = 'All 'True
type MEmpty Source # |
Instance details Defined in Fcf.Class.Monoid type MEmpty = 'Any 'False
type MEmpty Source # |
Instance details Defined in Fcf.Class.Monoid type MEmpty = 'EQ
type MEmpty Source # |
Instance details Defined in Fcf.Class.Monoid type MEmpty = '()
type MEmpty Source # |
Instance details Defined in Fcf.Class.Monoid type MEmpty = ""
type MEmpty Source # |
Instance details Defined in Fcf.Class.Monoid.Types type MEmpty = 'Endo (Pure :: a -> a -> Type)
type MEmpty Source # |
Instance details Defined in Fcf.Class.Monoid type MEmpty = 'Nothing :: Maybe a
type MEmpty Source # |
Instance details Defined in Fcf.Class.Monoid type MEmpty = '[] :: [a]
type MEmpty Source # |
Instance details Defined in Fcf.Class.Monoid type MEmpty = '(MEmpty :: k1, MEmpty :: k2)
type MEmpty Source # |
Instance details Defined in Fcf.Class.Monoid type MEmpty = '(MEmpty :: k1, MEmpty :: k2, MEmpty :: k3)

# First-class families

Can be composed and passed to higher-order functions.

data ((b :: a) .<> (c :: a)) (d :: a) Source #

Type-level semigroup composition `(`<>`)`.

This is the fcf-encoding of `(`<>`)`. To define a new semigroup, add type instances to `(`<>`)`.

#### Instances

Instances details

type Eval (x .<> y :: a -> Type) Source # |
Instance details Defined in Fcf.Class.Monoid type Eval (x .<> y :: a -> Type) = x <> y

data MEmpty_ (b :: a) Source #

Type-level monoid identity `mempty`.

This is the fcf-encoding of `MEmpty`.

#### Instances

Instances details

type Eval (MEmpty_ :: a -> Type) Source # |
Instance details Defined in Fcf.Class.Monoid type Eval (MEmpty_ :: a -> Type) = MEmpty :: a