generics-sop-0.3.2.0: Generic Programming using True Sums of Products

Safe HaskellSafe
LanguageHaskell2010

Generics.SOP.Sing

Contents

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.

Synopsis

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.

Since: 0.2

Constructors

SNil :: SList '[] 
SCons :: SListI xs => SList (x ': xs) 
Instances
Eq (SList xs) Source # 
Instance details

Defined in Generics.SOP.Sing

Methods

(==) :: SList xs -> SList xs -> Bool #

(/=) :: SList xs -> SList xs -> Bool #

Ord (SList xs) Source # 
Instance details

Defined in Generics.SOP.Sing

Methods

compare :: SList xs -> SList xs -> Ordering #

(<) :: SList xs -> SList xs -> Bool #

(<=) :: SList xs -> SList xs -> Bool #

(>) :: SList xs -> SList xs -> Bool #

(>=) :: SList xs -> SList xs -> Bool #

max :: SList xs -> SList xs -> SList xs #

min :: SList xs -> SList xs -> SList xs #

Show (SList xs) Source # 
Instance details

Defined in Generics.SOP.Sing

Methods

showsPrec :: Int -> SList xs -> ShowS #

show :: SList xs -> String #

showList :: [SList xs] -> ShowS #

class SListI (xs :: [k]) where Source #

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.

Since: 0.2

Minimal complete definition

sList

Methods

sList :: SList xs Source #

Get hold of the explicit singleton (that one can then pattern match on).

Instances
SListI ([] :: [k]) Source # 
Instance details

Defined in Generics.SOP.Sing

Methods

sList :: SList [] Source #

SListI xs => SListI (x ': xs :: [k]) Source # 
Instance details

Defined in Generics.SOP.Sing

Methods

sList :: SList (x ': xs) Source #

type Sing = SList Source #

Deprecated: Use SList instead.

Explicit singleton type.

Just provided for limited backward compatibility.

class SListI xs => SingI (xs :: [k]) where Source #

Deprecated: Use SListI instead.

General class for implicit singletons.

Just provided for limited backward compatibility.

Minimal complete definition

sing

Methods

sing :: Sing xs Source #

Deprecated: Use sList instead.

Instances
SListI xs => SingI (xs :: [k]) Source # 
Instance details

Defined in Generics.SOP.Constraint

Methods

sing :: Sing xs Source #

(All (SListI :: [k] -> Constraint) xss, SListI xss) => SingI (xss :: [[k]]) Source # 
Instance details

Defined in Generics.SOP.Constraint

Methods

sing :: Sing xss Source #

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)

Constructors

ShapeNil :: Shape '[] 
ShapeCons :: SListI xs => Shape xs -> Shape (x ': xs) 
Instances
Eq (Shape xs) Source # 
Instance details

Defined in Generics.SOP.Sing

Methods

(==) :: Shape xs -> Shape xs -> Bool #

(/=) :: Shape xs -> Shape xs -> Bool #

Ord (Shape xs) Source # 
Instance details

Defined in Generics.SOP.Sing

Methods

compare :: Shape xs -> Shape xs -> Ordering #

(<) :: Shape xs -> Shape xs -> Bool #

(<=) :: Shape xs -> Shape xs -> Bool #

(>) :: Shape xs -> Shape xs -> Bool #

(>=) :: Shape xs -> Shape xs -> Bool #

max :: Shape xs -> Shape xs -> Shape xs #

min :: Shape xs -> Shape xs -> Shape xs #

Show (Shape xs) Source # 
Instance details

Defined in Generics.SOP.Sing

Methods

showsPrec :: Int -> Shape xs -> ShowS #

show :: Shape xs -> String #

showList :: [Shape xs] -> ShowS #

shape :: forall (xs :: [k]). SListI xs => Shape xs Source #

The shape of a type-level list.

lengthSList :: forall (xs :: [k]) proxy. SListI xs => proxy xs -> Int Source #

The length of a type-level list.

Since: 0.2

lengthSing :: SListI xs => proxy xs -> Int Source #

Deprecated: Use lengthSList instead.

Old name for lengthSList.