| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Generics.SOP.Sing
Description
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.
Singletons
data SList :: [k] -> * where Source
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.
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.
The class SListI should have instances that match the
constructors of SList.
Methods
Get hold of the explicit singleton (that one can then pattern match on).
Deprecated: Use SList instead.
Explicit singleton type.
Just provided for limited backward compatibility.
class SListI xs => SingI xs where Source
Deprecated: Use SListI instead.
General class for implicit singletons.
Just provided for limited backward compatibility.
Shape of type-level lists
data Shape :: [k] -> * where Source
Occassionally it is useful to have an explicit, term-level, representation of type-level lists (esp because of https://ghc.haskell.org/trac/ghc/ticket/9108)
lengthSList :: forall xs proxy. SListI xs => proxy xs -> Int Source
The length of a type-level list.
lengthSing :: SListI xs => proxy xs -> Int Source
Deprecated: Use lengthSList instead.
Old name for lengthSList.