witness-0.6.1: values that witness types
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Type.Witness.General.Representative

Synopsis

Documentation

isWitnessRepresentative :: Dict (Is rep a) -> rep a Source #

type Subrepresentative (p :: k -> Type) (q :: k -> Type) = forall (a :: k). p a -> Dict (Is q a) Source #

withSubrepresentative :: Subrepresentative p q -> p a -> (Is q a => r) -> r Source #

class Representative rep where Source #

Methods

getRepWitness :: Subrepresentative rep rep Source #

Every value is an instance of Is.

Instances

Instances details
Representative NaturalType Source # 
Instance details

Defined in Data.Type.Witness.Specific.Natural

Representative PeanoNatType Source # 
Instance details

Defined in Data.Type.Witness.Specific.PeanoNat

Representative SymbolType Source # 
Instance details

Defined in Data.Type.Witness.Specific.Symbol

Representative w => Representative (ListProductType w :: Type -> Type) Source # 
Instance details

Defined in Data.Type.Witness.Specific.List.Product

Representative w => Representative (ListSumType w :: Type -> Type) Source # 
Instance details

Defined in Data.Type.Witness.Specific.List.Sum

Representative (Proxy :: k -> Type) Source # 
Instance details

Defined in Data.Type.Witness.General.Representative

Representative (EmptyType :: k -> Type) Source # 
Instance details

Defined in Data.Type.Witness.Specific.Empty

Representative ((:~:) t :: k -> Type) Source # 
Instance details

Defined in Data.Type.Witness.General.Representative

(Representative w1, Representative w2) => Representative (PairType w1 w2 :: k -> Type) Source # 
Instance details

Defined in Data.Type.Witness.Specific.Pair

Representative (Compose Dict c :: k -> Type) Source # 
Instance details

Defined in Data.Type.Witness.General.Representative

Representative w => Representative (ListType w :: [k] -> Type) Source # 
Instance details

Defined in Data.Type.Witness.Specific.List.List

withRepresentative :: Representative rep => rep a -> (Is rep a => r) -> r Source #

class Representative rep => Is rep a where Source #

If two representatives have the same type, then they have the same value.

Methods

representative :: rep a Source #

The representative value for type a.

Instances

Instances details
KnownNat bn => Is NaturalType (bn :: Nat) Source # 
Instance details

Defined in Data.Type.Witness.Specific.Natural

Is PeanoNatType 'Zero Source # 
Instance details

Defined in Data.Type.Witness.Specific.PeanoNat

KnownSymbol symbol => Is SymbolType (symbol :: Symbol) Source # 
Instance details

Defined in Data.Type.Witness.Specific.Symbol

Is PeanoNatType n => Is PeanoNatType ('Succ n :: PeanoNat) Source # 
Instance details

Defined in Data.Type.Witness.Specific.PeanoNat

Representative w => Is (ListProductType w :: Type -> Type) () Source # 
Instance details

Defined in Data.Type.Witness.Specific.List.Product

Representative w => Is (ListSumType w :: Type -> Type) Void Source # 
Instance details

Defined in Data.Type.Witness.Specific.List.Sum

Is (Proxy :: k -> Type) (a :: k) Source # 
Instance details

Defined in Data.Type.Witness.General.Representative

(Is w a, Is (ListProductType w) ar) => Is (ListProductType w :: Type -> Type) ((a, ar) :: Type) Source # 
Instance details

Defined in Data.Type.Witness.Specific.List.Product

(Is w a, Is (ListSumType w) ar) => Is (ListSumType w :: Type -> Type) (Either a ar :: Type) Source # 
Instance details

Defined in Data.Type.Witness.Specific.List.Sum

Is ((:~:) t :: k -> Type) (t :: k) Source # 
Instance details

Defined in Data.Type.Witness.General.Representative

Methods

representative :: t :~: t Source #

(Is w1 t, Is w2 t) => Is (PairType w1 w2 :: k -> Type) (t :: k) Source # 
Instance details

Defined in Data.Type.Witness.Specific.Pair

Methods

representative :: PairType w1 w2 t Source #

c t => Is (Compose Dict c :: k -> Type) (t :: k) Source # 
Instance details

Defined in Data.Type.Witness.General.Representative

Representative w => Is (ListType w :: [k] -> Type) ('[] :: [k]) Source # 
Instance details

Defined in Data.Type.Witness.Specific.List.List

(Is w a2, Is (ListType w) lt) => Is (ListType w :: [a1] -> Type) (a2 ': lt :: [a1]) Source # 
Instance details

Defined in Data.Type.Witness.Specific.List.List

Methods

representative :: ListType w (a2 ': lt) Source #

getRepresentative :: Is rep a => a -> rep a Source #

rerepresentative :: Is rep a => p a -> rep a Source #

fromRepWitness :: Dict (Is rep a) -> rep a Source #

mkSomeOf :: Is rep a => a -> SomeOf rep Source #

mkSomeFor :: Is rep a => f a -> SomeFor f rep Source #

typeValue :: forall k (rep :: k -> Type) (a :: k). (Is rep a, WitnessValue rep) => WitnessValueType rep Source #

matchIs :: forall w a b. (TestEquality w, Is w a, Is w b) => Maybe (a :~: b) Source #

See whether two represented and witnessed types are the same.