HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Modulesop-core-0.5.0.2Haskell2010

Data.SOP.Sing

Singleton types corresponding to type-level data structures.

The implementation is similar, but subtly different to that of the singletons package. See the "True Sums of Products" paper for details.

Contents
  1. Singletons
  2. Shape of type-level lists
Synopsis
  • Packagesop-core-0.5.0.2
  • Exports8
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceSing.hs

Singletons

datadata SList (a :: [k]) where

Explicit singleton list.

A singleton list can be used to reveal the structure of a type-level list argument that the function is quantified over. For every type-level list xs, there is one non-bottom value of type SList xs.

Note that these singleton lists are polymorphic in the list elements; we do not require a singleton representation for them.

Constructors

Instances3Eq, Ord, Show
  • Eq (SList xs)Defined in sop-core-0.5.0.2 · Data.SOP.Sing
  • Ord (SList xs)Defined in sop-core-0.5.0.2 · Data.SOP.Sing
  • Show (SList xs)Defined in sop-core-0.5.0.2 · Data.SOP.Sing
typetype SListI = All Top

Implicit singleton list.

A singleton list can be used to reveal the structure of a type-level list argument that the function is quantified over.

Since 0.4.0.0, this is now defined in terms of All. A singleton list provides a witness for a type-level list where the elements need not satisfy any additional constraints.

valuesList :: SListI xs => SList xs

Get hold of an explicit singleton (that one can then pattern match on) for a type-level list

valuepara_SList
  1. :: SListI xs
  2. => r '[]
  3. -> forall (y :: a) (ys :: [a]). SListI ys => r ys -> r (y ': ys)
  4. -> r xs

Paramorphism for a type-level list.

valuecase_SList
  1. :: SListI xs
  2. => r '[]
  3. -> forall (y :: a) (ys :: [a]). SListI ys => r (y ': ys)
  4. -> r xs

Case distinction on a type-level list.

Shape of type-level lists