type-combinators-singletons-0.2.0.0: Interop between /type-combinators/ and /singletons/.

Copyright(c) Justin Le 2017
LicenseBSD-3
Maintainerjustin@jle.im
Stabilityunstable
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Data.Type.Combinator.Singletons

Contents

Description

There's a lot of identical data types between type-combinators and singetons, as well as similar typeclasses. This module provides conversion functions between the two (through the TC typeclass), and also many appropriate orphan instances.

Synopsis

Conversion functions

class TC f where Source #

Typeclass for type-combinator types that can be converted to and from singletons.

Minimal complete definition

fromTC, toTC

Methods

fromTC :: f a -> Sing a Source #

Convert a type-combinator type that is equivalent to a singleton into its equivalent Sing.

toTC :: Sing a -> f a Source #

Convert a Sing into its equivalent type-combinator type.

Instances

TC Bool Boolean Source # 

Methods

fromTC :: f a -> Sing Boolean a Source #

toTC :: Sing Boolean a -> f a Source #

TC N Nat Source # 

Methods

fromTC :: f a -> Sing Nat a Source #

toTC :: Sing Nat a -> f a Source #

TC [k] (Prod k (Sing k)) Source # 

Methods

fromTC :: f a -> Sing (Prod k (Sing k)) a Source #

toTC :: Sing (Prod k (Sing k)) a -> f a Source #

TC (Maybe k) (Option k (Sing k)) Source # 

Methods

fromTC :: f a -> Sing (Option k (Sing k)) a Source #

toTC :: Sing (Option k (Sing k)) a -> f a Source #

TC (Either k l) ((:+:) k l (Sing k) (Sing l)) Source # 

Methods

fromTC :: f a -> Sing ((k :+: l) (Sing k) (Sing l)) a Source #

toTC :: Sing ((k :+: l) (Sing k) (Sing l)) a -> f a Source #

TC (k, l) ((:*:) k l (Sing k) (Sing l)) Source # 

Methods

fromTC :: f a -> Sing ((k :*: l) (Sing k) (Sing l)) a Source #

toTC :: Sing ((k :*: l) (Sing k) (Sing l)) a -> f a Source #

singLength :: Sing as -> Length as Source #

Convert a Sing for as into a Length representing the length of as.

Length as is equivalent to Prod Proxy as, so this is basically

singLength :: Sing as -> Prod Proxy as
singLength = map1 (const Proxy) . toTC

This function is one-way, since the actual run-time information on the types in as is lost.

Orphan singleton instance for N

data family Sing k (a :: k) :: * #

The singleton kind-indexed data family.

Instances

TC [k] (Prod k (Sing k)) Source # 

Methods

fromTC :: f a -> Sing (Prod k (Sing k)) a Source #

toTC :: Sing (Prod k (Sing k)) a -> f a Source #

TC (Maybe k) (Option k (Sing k)) Source # 

Methods

fromTC :: f a -> Sing (Option k (Sing k)) a Source #

toTC :: Sing (Option k (Sing k)) a -> f a Source #

TC (Either k l) ((:+:) k l (Sing k) (Sing l)) Source # 

Methods

fromTC :: f a -> Sing ((k :+: l) (Sing k) (Sing l)) a Source #

toTC :: Sing ((k :+: l) (Sing k) (Sing l)) a -> f a Source #

TC (k, l) ((:*:) k l (Sing k) (Sing l)) Source # 

Methods

fromTC :: f a -> Sing ((k :*: l) (Sing k) (Sing l)) a Source #

toTC :: Sing ((k :*: l) (Sing k) (Sing l)) a -> f a Source #

data Sing Bool 
data Sing Bool where
data Sing Ordering 
data Sing Nat 
data Sing Nat where
data Sing Symbol 
data Sing Symbol where
data Sing () 
data Sing () where
data Sing N # 
data Sing N where
type KnownC k (Sing k) a # 
type KnownC k (Sing k) a = SingI k a
type WitnessC ØC (SingI k a) (Sing k a) # 
type WitnessC ØC (SingI k a) (Sing k a) = ØC
data Sing [a] 
data Sing [a] where
data Sing (Maybe a) 
data Sing (Maybe a) where
data Sing (NonEmpty a) 
data Sing (NonEmpty a) where
data Sing (Either a b) 
data Sing (Either a b) where
data Sing (a, b) 
data Sing (a, b) where
data Sing ((~>) k1 k2) 
data Sing ((~>) k1 k2) = SLambda {}
data Sing (a, b, c) 
data Sing (a, b, c) where
data Sing (a, b, c, d) 
data Sing (a, b, c, d) where
data Sing (a, b, c, d, e) 
data Sing (a, b, c, d, e) where
data Sing (a, b, c, d, e, f) 
data Sing (a, b, c, d, e, f) where
data Sing (a, b, c, d, e, f, g) 
data Sing (a, b, c, d, e, f, g) where

type SN = (Sing :: N -> Type) Source #

type ZSym0 = Z Source #

data SSym0 (l :: TyFun N N) Source #

Instances

type SSym1 (t :: N) = S t Source #

Orphan instances

SingKind N Source # 

Associated Types

type Demote N = (r :: *) #

Methods

fromSing :: Sing N a -> Demote N #

toSing :: Demote N -> SomeSing N #

SingI N Z Source # 

Methods

sing :: Sing Z a #

SingI N n => SingI N (S n) Source # 

Methods

sing :: Sing (S n) a #

SEq k3 => Eq1 k3 (Sing k3) Source # 

Methods

eq1 :: f a -> f a -> Bool #

neq1 :: f a -> f a -> Bool #

SOrd k3 => Ord1 k3 (Sing k3) Source # 

Methods

compare1 :: f a -> f a -> Ordering #

(<#) :: f a -> f a -> Bool #

(>#) :: f a -> f a -> Bool #

(<=#) :: f a -> f a -> Bool #

(>=#) :: f a -> f a -> Bool #

SingI k a => Known k (Sing k) a Source # 

Associated Types

type KnownC (Sing k) (a :: Sing k -> *) (a :: Sing k) :: Constraint #

Methods

known :: a a #

Witness ØC (SingI k a) (Sing k a) Source # 

Associated Types

type WitnessC ØC (SingI k a) (Sing k a) :: Constraint #

Methods

(\\) :: ØC => (SingI k a -> r) -> Sing k a -> r #