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

Safe Haskell | Safe-Inferred
Language | Haskell2010

Fcf.Classes

Description

Deprecated: Use Fcf.Class.Functor or Fcf.Class.Bifunctor instead.

Overloaded functions.

Synopsis

- data Map (c :: a -> Exp b) (d :: f a) (e :: f b)
- data Bimap (c :: a -> Exp a') (d :: b -> Exp b') (e :: f a b) (g :: f a' b')

# Documentation

data Map (c :: a -> Exp b) (d :: f a) (e :: f b) Source #

Type-level `fmap` for type-level functors.

Note: this name clashes with `Map` from containers. `FMap` is provided as a synonym to avoid this.

### Example

Expand

    >>> data Example where Ex :: a -> Example  -- Hide the type of examples to avoid brittleness in different GHC versions
    >>> data AddMul :: Nat -> Nat -> Exp Nat
    >>> type instance Eval (AddMul x y) = (x TL.+ y) TL.* (x TL.+ y)
    >>> :kind! Ex (Eval (Map (AddMul 2) '[0, 1, 2, 3, 4]) :: [Nat])
    Ex (Eval (Map (AddMul 2) '[0, 1, 2, 3, 4]) :: [Nat]) :: Example
    = Ex [4, 9, 16, 25, 36]

#### Instances

Instances details

type Eval (Map f ('Just a3) :: Maybe a2 -> Type) Source # |
Instance details Defined in Fcf.Class.Functor type Eval (Map f ('Just a3) :: Maybe a2 -> Type) = 'Just (Eval (f a3))
type Eval (Map f ('Nothing :: Maybe a) :: Maybe b -> Type) Source # |
Instance details Defined in Fcf.Class.Functor type Eval (Map f ('Nothing :: Maybe a) :: Maybe b -> Type) = 'Nothing :: Maybe b
type Eval (Map f ('[] :: [a]) :: [b] -> Type) Source # |
Instance details Defined in Fcf.Class.Functor type Eval (Map f ('[] :: [a]) :: [b] -> Type) = '[] :: [b]
type Eval (Map f (a2 ': as) :: [b] -> Type) Source # |
Instance details Defined in Fcf.Class.Functor type Eval (Map f (a2 ': as) :: [b] -> Type) = Eval (f a2) ': Eval (Map f as)
type Eval (Map f ('Left x :: Either a2 a1) :: Either a2 b -> Type) Source # |
Instance details Defined in Fcf.Class.Functor type Eval (Map f ('Left x :: Either a2 a1) :: Either a2 b -> Type) = 'Left x :: Either a2 b
type Eval (Map f ('Right a3 :: Either a2 a1) :: Either a2 b -> Type) Source # |
Instance details Defined in Fcf.Class.Functor type Eval (Map f ('Right a3 :: Either a2 a1) :: Either a2 b -> Type) = 'Right (Eval (f a3)) :: Either a2 b
type Eval (Map f '(x, a2) :: (k2, k1) -> Type) Source # |
Instance details Defined in Fcf.Class.Functor type Eval (Map f '(x, a2) :: (k2, k1) -> Type) = '(x, Eval (f a2))
type Eval (Map f '(x, y, a2) :: (k2, k3, k1) -> Type) Source # |
Instance details Defined in Fcf.Class.Functor type Eval (Map f '(x, y, a2) :: (k2, k3, k1) -> Type) = '(x, y, Eval (f a2))
type Eval (Map f '(x, y, z, a2) :: (k2, k3, k4, k1) -> Type) Source # |
Instance details Defined in Fcf.Class.Functor type Eval (Map f '(x, y, z, a2) :: (k2, k3, k4, k1) -> Type) = '(x, y, z, Eval (f a2))
type Eval (Map f '(x, y, z, w, a2) :: (k2, k3, k4, k5, k1) -> Type) Source # |
Instance details Defined in Fcf.Class.Functor type Eval (Map f '(x, y, z, w, a2) :: (k2, k3, k4, k5, k1) -> Type) = '(x, y, z, w, Eval (f a2))

data Bimap (c :: a -> Exp a') (d :: b -> Exp b') (e :: f a b) (g :: f a' b') Source #

Type-level `bimap`.

### Example

Expand

    >>> data Example where Ex :: a -> Example  -- Hide the type of examples to avoid brittleness in different GHC versions
    >>> :kind! Ex (Eval (Bimap ((+) 1) (Flip (-) 1) '(2, 4)) :: (Natural, Natural))
    Ex (Eval (Bimap ((+) 1) (Flip (-) 1) '(2, 4)) :: (Natural, Natural)) :: Example
    = Ex '(3, 3)

#### Instances

Instances details

type Eval (Bimap f g ('Right y :: Either a b1) :: Either a' b2 -> Type) Source # |
Instance details Defined in Fcf.Class.Bifunctor type Eval (Bimap f g ('Right y :: Either a b1) :: Either a' b2 -> Type) = 'Right (Eval (g y)) :: Either a' b2
type Eval (Bimap f g ('Left x :: Either a1 b) :: Either a2 b' -> Type) Source # |
Instance details Defined in Fcf.Class.Bifunctor type Eval (Bimap f g ('Left x :: Either a1 b) :: Either a2 b' -> Type) = 'Left (Eval (f x)) :: Either a2 b'
type Eval (Bimap f g '(x, y) :: (k1, k2) -> Type) Source # |
Instance details Defined in Fcf.Class.Bifunctor type Eval (Bimap f g '(x, y) :: (k1, k2) -> Type) = '(Eval (f x), Eval (g y))