singletons-2.6: A framework for generating singleton types

Copyright | (C) 2018 Ryan Scott
License | BSD-style (see LICENSE)
Maintainer | Richard Eisenberg (rae@cs.brynmawr.edu)
Stability | experimental
Portability | non-portable
Safe Haskell | None
Language | Haskell2010

Data.Singletons.Prelude.Const

Contents

- The `Const` singleton
- Defunctionalization symbols
- Orphan instances

Description

Exports the promoted and singled versions of the `Const` data type.

Synopsis

- type family Sing :: k -> Type
- data SConst :: forall (k :: Type) (a :: Type) (b :: k). Const a b -> Type where
  - SConst :: {..} -> SConst ('Const a)
- type family GetConst (x :: Const a b) :: a where ...
- data ConstSym0 :: forall (a6989586621679090105 :: Type) k6989586621679090104 (b6989586621679090106 :: k6989586621679090104). (~>) a6989586621679090105 (Const (a6989586621679090105 :: Type) (b6989586621679090106 :: k6989586621679090104))
- type ConstSym1 (t6989586621680754547 :: a6989586621679090105) = 'Const t6989586621680754547
- data GetConstSym0 :: forall a6989586621680754815 b6989586621680754816. (~>) (Const a6989586621680754815 b6989586621680754816) a6989586621680754815
- type GetConstSym1 (x6989586621680754817 :: Const a6989586621680754815 b6989586621680754816) = GetConst x6989586621680754817

# The `Const` singleton

type family Sing :: k -> Type Source #

The singleton kind-indexed type family.

#### Instances

Instances details

type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Instances type Sing = SBool
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Instances type Sing = SOrdering
type Sing Source # |
Instance details Defined in Data.Singletons.TypeLits.Internal type Sing = SNat
type Sing Source # |
Instance details Defined in Data.Singletons.TypeLits.Internal type Sing = SSymbol
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Instances type Sing = STuple0
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Instances type Sing = SVoid
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Semigroup.Internal type Sing = SAll
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Semigroup.Internal type Sing = SAny
type Sing Source # |
Instance details Defined in Data.Singletons.TypeError type Sing = SErrorMessage
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Instances type Sing = SList :: [a] -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Instances type Sing = SMaybe :: Maybe a -> Type

type Sing Source #

A choice of singleton for the kind ``TYPE` rep` (for some `RuntimeRep` `rep`), an instantiation of which is the famous kind `Type`.

Conceivably, one could generalize this instance to `Sing @k` for any kind `k`, and remove all other `Sing` instances. We don't adopt this design, however, since it is far more convenient in practice to work with explicit singleton values than `TypeRep`s (for instance, `TypeRep`s are more difficult to pattern match on, and require extra runtime checks).

We cannot produce explicit singleton values for everything in ``TYPE` rep`, however, since it is an open kind, so we reach for `TypeRep` in this one particular case.

Instance details Defined in Data.Singletons.TypeRepTYPE type Sing = TypeRep :: TYPE rep -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Instances type Sing = SNonEmpty :: NonEmpty a -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Ord type Sing = SDown :: Down a -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Instances type Sing = SIdentity :: Identity a -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Semigroup.Internal type Sing = SFirst :: First a -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Semigroup.Internal type Sing = SLast :: Last a -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Semigroup.Internal type Sing = SMax :: Max a -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Semigroup.Internal type Sing = SMin :: Min a -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Semigroup.Internal type Sing = SOption :: Option a -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Semigroup.Internal type Sing = SWrappedMonoid :: WrappedMonoid m -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Semigroup.Internal type Sing = SDual :: Dual a -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Semigroup.Internal type Sing = SProduct :: Product a -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Semigroup.Internal type Sing = SSum :: Sum a -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Monoid type Sing = SFirst :: First a -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Monoid type Sing = SLast :: Last a -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Instances type Sing = SEither :: Either a b -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Instances type Sing = STuple2 :: (a, b) -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Internal type Sing = SLambda :: (k1 ~> k2) -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Internal type Sing = SWrappedSing :: WrappedSing a -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Semigroup type Sing = SArg :: Arg a b -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Sigma type Sing = SSigma :: Sigma s t -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Instances type Sing = STuple3 :: (a, b, c) -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Const type Sing = SConst :: Const a b -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Instances type Sing = STuple4 :: (a, b, c, d) -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Instances type Sing = STuple5 :: (a, b, c, d, e) -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Instances type Sing = STuple6 :: (a, b, c, d, e, f) -> Type
type Sing Source # |
Instance details Defined in Data.Singletons.Prelude.Instances type Sing = STuple7 :: (a, b, c, d, e, f, g) -> Type

data SConst :: forall (k :: Type) (a :: Type) (b :: k). Const a b -> Type where Source #

Constructors

SConst |

Fields

- :: { sGetConst :: Sing a
- } -> SConst ('Const a)

#### Instances

Instances details

SDecide a => TestCoercion (SConst :: Const a b -> Type) Source # |
Instance details Defined in Data.Singletons.Prelude.Const Methods testCoercion :: forall (a0 :: k) (b0 :: k). SConst a0 -> SConst b0 -> Maybe (Coercion a0 b0)
SDecide a => TestEquality (SConst :: Const a b -> Type) Source # |
Instance details Defined in Data.Singletons.Prelude.Const Methods testEquality :: forall (a0 :: k) (b0 :: k). SConst a0 -> SConst b0 -> Maybe (a0 :~: b0)

type family GetConst (x :: Const a b) :: a where ... Source #

Equations

GetConst ('Const x) = x |

# Defunctionalization symbols

data ConstSym0 :: forall (a6989586621679090105 :: Type) k6989586621679090104 (b6989586621679090106 :: k6989586621679090104). (~>) a6989586621679090105 (Const (a6989586621679090105 :: Type) (b6989586621679090106 :: k6989586621679090104)) Source #

#### Instances

Instances details

SingI (ConstSym0 :: TyFun a6989586621679090105 (Const a6989586621679090105 b6989586621679090106) -> Type) Source # |
Instance details Defined in Data.Singletons.Prelude.Const Methods sing :: Sing ConstSym0 Source #
SuppressUnusedWarnings (ConstSym0 :: TyFun a6989586621679090105 (Const a6989586621679090105 b6989586621679090106) -> Type) Source # |
Instance details Defined in Data.Singletons.Prelude.Const Methods suppressUnusedWarnings :: () Source #
type Apply (ConstSym0 :: TyFun a (Const a b6989586621679090106) -> Type) (t6989586621680754547 :: a) Source # |
Instance details Defined in Data.Singletons.Prelude.Const type Apply (ConstSym0 :: TyFun a (Const a b6989586621679090106) -> Type) (t6989586621680754547 :: a) = 'Const t6989586621680754547 :: Const a b6989586621679090106

type ConstSym1 (t6989586621680754547 :: a6989586621679090105) = 'Const t6989586621680754547 Source #

data GetConstSym0 :: forall a6989586621680754815 b6989586621680754816. (~>) (Const a6989586621680754815 b6989586621680754816) a6989586621680754815 Source #

#### Instances

Instances details

SuppressUnusedWarnings (GetConstSym0 :: TyFun (Const a6989586621680754815 b6989586621680754816) a6989586621680754815 -> Type) Source # |
Instance details Defined in Data.Singletons.Prelude.Const Methods suppressUnusedWarnings :: () Source #
type Apply (GetConstSym0 :: TyFun (Const a b) a -> Type) (x6989586621680754817 :: Const a b) Source # |
Instance details Defined in Data.Singletons.Prelude.Const type Apply (GetConstSym0 :: TyFun (Const a b) a -> Type) (x6989586621680754817 :: Const a b) = GetConst x6989586621680754817

type GetConstSym1 (x6989586621680754817 :: Const a6989586621680754815 b6989586621680754816) = GetConst x6989586621680754817 Source #

# Orphan instances

SMonoid m => SApplicative (Const m :: Type -> Type) Source # |

Instance details

Methods

sPure :: forall a (t :: a). Sing t -> Sing (Apply PureSym0 t) Source #

(%<*>) :: forall a b (t :: Const m (a ~> b)) (t :: Const m a). Sing t -> Sing t -> Sing (Apply (Apply (<*>@#@$) t) t) Source #

sLiftA2 :: forall a b c (t :: a ~> (b ~> c)) (t :: Const m a) (t :: Const m b). Sing t -> Sing t -> Sing t -> Sing (Apply (Apply (Apply LiftA2Sym0 t) t) t) Source #

(%*>) :: forall a b (t :: Const m a) (t :: Const m b). Sing t -> Sing t -> Sing (Apply (Apply (*>@#@$) t) t) Source #

(%<*) :: forall a b (t :: Const m a) (t :: Const m b). Sing t -> Sing t -> Sing (Apply (Apply (<*@#@$) t) t) Source #

SFunctor (Const m :: Type -> Type) Source # |
Instance details Methods sFmap :: forall a b (t :: a ~> b) (t :: Const m a). Sing t -> Sing t -> Sing (Apply (Apply FmapSym0 t) t) Source # (%<$) :: forall a b (t :: a) (t :: Const m b). Sing t -> Sing t -> Sing (Apply (Apply (<$@#@$) t) t) Source #
PApplicative (Const m :: Type -> Type) Source # |
Instance details Associated Types type Pure arg :: f a Source # type arg <*> arg :: f b Source # type LiftA2 arg arg arg :: f c Source # type arg *> arg :: f b Source # type arg <* arg :: f a Source #
PFunctor (Const m :: Type -> Type) Source # |
Instance details Associated Types type Fmap arg arg :: f b Source # type arg <$ arg :: f a Source #
SFoldable (Const m :: Type -> Type) Source # |

Instance details

Methods

sFold :: forall m0 (t :: Const m m0). SMonoid m0 => Sing t -> Sing (Apply FoldSym0 t) Source #

sFoldMap :: forall a m0 (t :: a ~> m0) (t :: Const m a). SMonoid m0 => Sing t -> Sing t -> Sing (Apply (Apply FoldMapSym0 t) t) Source #

sFoldr :: forall a b (t :: a ~> (b ~> b)) (t :: b) (t :: Const m a). Sing t -> Sing t -> Sing t -> Sing (Apply (Apply (Apply FoldrSym0 t) t) t) Source #

sFoldr' :: forall a b (t :: a ~> (b ~> b)) (t :: b) (t :: Const m a). Sing t -> Sing t -> Sing t -> Sing (Apply (Apply (Apply Foldr'Sym0 t) t) t) Source #

sFoldl :: forall b a (t :: b ~> (a ~> b)) (t :: b) (t :: Const m a). Sing t -> Sing t -> Sing t -> Sing (Apply (Apply (Apply FoldlSym0 t) t) t) Source #

sFoldl' :: forall b a (t :: b ~> (a ~> b)) (t :: b) (t :: Const m a). Sing t -> Sing t -> Sing t -> Sing (Apply (Apply (Apply Foldl'Sym0 t) t) t) Source #

sFoldr1 :: forall a (t :: a ~> (a ~> a)) (t :: Const m a). Sing t -> Sing t -> Sing (Apply (Apply Foldr1Sym0 t) t) Source #

sFoldl1 :: forall a (t :: a ~> (a ~> a)) (t :: Const m a). Sing t -> Sing t -> Sing (Apply (Apply Foldl1Sym0 t) t) Source #

sToList :: forall a (t :: Const m a). Sing t -> Sing (Apply ToListSym0 t) Source #

sNull :: forall a (t :: Const m a). Sing t -> Sing (Apply NullSym0 t) Source #

sLength :: forall a (t :: Const m a). Sing t -> Sing (Apply LengthSym0 t) Source #

sElem :: forall a (t :: a) (t :: Const m a). SEq a => Sing t -> Sing t -> Sing (Apply (Apply ElemSym0 t) t) Source #

sMaximum :: forall a (t :: Const m a). SOrd a => Sing t -> Sing (Apply MaximumSym0 t) Source #

sMinimum :: forall a (t :: Const m a). SOrd a => Sing t -> Sing (Apply MinimumSym0 t) Source #

sSum :: forall a (t :: Const m a). SNum a => Sing t -> Sing (Apply SumSym0 t) Source #

sProduct :: forall a (t :: Const m a). SNum a => Sing t -> Sing (Apply ProductSym0 t) Source #

PFoldable (Const m :: Type -> Type) Source # |

Instance details

Associated Types

type Fold arg :: m Source #

type FoldMap arg arg :: m Source #

type Foldr arg arg arg :: b Source #

type Foldr' arg arg arg :: b Source #

type Foldl arg arg arg :: b Source #

type Foldl' arg arg arg :: b Source #

type Foldr1 arg arg :: a Source #

type Foldl1 arg arg :: a Source #

type ToList arg :: [a] Source #

type Null arg :: Bool Source #

type Length arg :: Nat Source #

type Elem arg arg :: Bool Source #

type Maximum arg :: a Source #

type Minimum arg :: a Source #

type Sum arg :: a Source #

type Product arg :: a Source #

SingKind a => SingKind (Const a b) Source # |
Instance details Associated Types type Demote (Const a b) = (r :: Type) Source # Methods fromSing :: forall (a0 :: Const a b). Sing a0 -> Demote (Const a b) Source # toSing :: Demote (Const a b) -> SomeSing (Const a b) Source #
SDecide a => SDecide (Const a b) Source # |
Instance details Methods (%~) :: forall (a0 :: Const a b) (b0 :: Const a b). Sing a0 -> Sing b0 -> Decision (a0 :~: b0) Source #
PEq (Const a b) Source # |
Instance details Associated Types type x == y :: Bool Source # type x /= y :: Bool Source #
SEq a => SEq (Const a b) Source # |
Instance details Methods (%==) :: forall (a0 :: Const a b) (b0 :: Const a b). Sing a0 -> Sing b0 -> Sing (a0 == b0) Source # (%/=) :: forall (a0 :: Const a b) (b0 :: Const a b). Sing a0 -> Sing b0 -> Sing (a0 /= b0) Source #
SOrd a => SOrd (Const a b) Source # |

Instance details

Methods

sCompare :: forall (t :: Const a b) (t :: Const a b). Sing t -> Sing t -> Sing (Apply (Apply CompareSym0 t) t) Source #

(%<) :: forall (t :: Const a b) (t :: Const a b). Sing t -> Sing t -> Sing (Apply (Apply (<@#@$) t) t) Source #

(%<=) :: forall (t :: Const a b) (t :: Const a b). Sing t -> Sing t -> Sing (Apply (Apply (<=@#@$) t) t) Source #

(%>) :: forall (t :: Const a b) (t :: Const a b). Sing t -> Sing t -> Sing (Apply (Apply (>@#@$) t) t) Source #

(%>=) :: forall (t :: Const a b) (t :: Const a b). Sing t -> Sing t -> Sing (Apply (Apply (>=@#@$) t) t) Source #

sMax :: forall (t :: Const a b) (t :: Const a b). Sing t -> Sing t -> Sing (Apply (Apply MaxSym0 t) t) Source #

sMin :: forall (t :: Const a b) (t :: Const a b). Sing t -> Sing t -> Sing (Apply (Apply MinSym0 t) t) Source #

POrd (Const a b) Source # |
Instance details Associated Types type Compare arg arg :: Ordering Source # type arg < arg :: Bool Source # type arg <= arg :: Bool Source # type arg > arg :: Bool Source # type arg >= arg :: Bool Source # type Max arg arg :: a Source # type Min arg arg :: a Source #
SNum a => SNum (Const a b) Source # |

Instance details

Methods

(%+) :: forall (t :: Const a b) (t :: Const a b). Sing t -> Sing t -> Sing (Apply (Apply (+@#@$) t) t) Source #

(%-) :: forall (t :: Const a b) (t :: Const a b). Sing t -> Sing t -> Sing (Apply (Apply (-@#@$) t) t) Source #

(%*) :: forall (t :: Const a b) (t :: Const a b). Sing t -> Sing t -> Sing (Apply (Apply (*@#@$) t) t) Source #

sNegate :: forall (t :: Const a b). Sing t -> Sing (Apply NegateSym0 t) Source #

sAbs :: forall (t :: Const a b). Sing t -> Sing (Apply AbsSym0 t) Source #

sSignum :: forall (t :: Const a b). Sing t -> Sing (Apply SignumSym0 t) Source #

sFromInteger :: forall (t :: Nat). Sing t -> Sing (Apply FromIntegerSym0 t) Source #

PNum (Const a b) Source # |
Instance details Associated Types type arg + arg :: a Source # type arg - arg :: a Source # type arg * arg :: a Source # type Negate arg :: a Source # type Abs arg :: a Source # type Signum arg :: a Source # type FromInteger arg :: a Source #
SBounded a => SBounded (Const a b) Source # |
Instance details Methods sMinBound :: Sing MinBoundSym0 Source # sMaxBound :: Sing MaxBoundSym0 Source #
PBounded (Const a b) Source # |
Instance details Associated Types type MinBound :: a Source # type MaxBound :: a Source #
SEnum a => SEnum (Const a b) Source # |

Instance details

Methods

sSucc :: forall (t :: Const a b). Sing t -> Sing (Apply SuccSym0 t) Source #

sPred :: forall (t :: Const a b). Sing t -> Sing (Apply PredSym0 t) Source #

sToEnum :: forall (t :: Nat). Sing t -> Sing (Apply ToEnumSym0 t) Source #

sFromEnum :: forall (t :: Const a b). Sing t -> Sing (Apply FromEnumSym0 t) Source #

sEnumFromTo :: forall (t :: Const a b) (t :: Const a b). Sing t -> Sing t -> Sing (Apply (Apply EnumFromToSym0 t) t) Source #

sEnumFromThenTo :: forall (t :: Const a b) (t :: Const a b) (t :: Const a b). Sing t -> Sing t -> Sing t -> Sing (Apply (Apply (Apply EnumFromThenToSym0 t) t) t) Source #

PEnum (Const a b) Source # |
Instance details Associated Types type Succ arg :: a Source # type Pred arg :: a Source # type ToEnum arg :: a Source # type FromEnum arg :: Nat Source # type EnumFromTo arg arg :: [a] Source # type EnumFromThenTo arg arg arg :: [a] Source #
SSemigroup a => SSemigroup (Const a b) Source # |
Instance details Methods (%<>) :: forall (t :: Const a b) (t :: Const a b). Sing t -> Sing t -> Sing (Apply (Apply (<>@#@$) t) t) Source # sSconcat :: forall (t :: NonEmpty (Const a b)). Sing t -> Sing (Apply SconcatSym0 t) Source #
PSemigroup (Const a b) Source # |
Instance details Associated Types type arg <> arg :: a Source # type Sconcat arg :: a Source #
SShow a => SShow (Const a b) Source # |
Instance details Methods sShowsPrec :: forall (t :: Nat) (t :: Const a b) (t :: Symbol). Sing t -> Sing t -> Sing t -> Sing (Apply (Apply (Apply ShowsPrecSym0 t) t) t) Source # sShow_ :: forall (t :: Const a b). Sing t -> Sing (Apply Show_Sym0 t) Source # sShowList :: forall (t :: [Const a b]) (t :: Symbol). Sing t -> Sing t -> Sing (Apply (Apply ShowListSym0 t) t) Source #
PShow (Const a b) Source # |
Instance details Associated Types type ShowsPrec arg arg arg :: Symbol Source # type Show_ arg :: Symbol Source # type ShowList arg arg :: Symbol Source #
SMonoid a => SMonoid (Const a b) Source # |
Instance details Methods sMempty :: Sing MemptySym0 Source # sMappend :: forall (t :: Const a b) (t :: Const a b). Sing t -> Sing t -> Sing (Apply (Apply MappendSym0 t) t) Source # sMconcat :: forall (t :: [Const a b]). Sing t -> Sing (Apply MconcatSym0 t) Source #
PMonoid (Const a b) Source # |
Instance details Associated Types type Mempty :: a Source # type Mappend arg arg :: a Source # type Mconcat arg :: a Source #
SingI a2 => SingI ('Const a2 :: Const a1 b) Source # |
Instance details Methods sing :: Sing ('Const a2) Source #