planet-mitchell-0.0.0: Planet Mitchell

Safe HaskellSafe
LanguageHaskell2010

Reflection

Synopsis

Documentation

class Reifies (s :: k) a | s -> a where #

Minimal complete definition

reflect

Methods

reflect :: proxy s -> a #

Recover a value inside a reify context, given a proxy for its reified type.

Instances
KnownNat n => Reifies (n :: Nat) Integer 
Instance details

Defined in Data.Reflection

Methods

reflect :: proxy n -> Integer #

KnownSymbol n => Reifies (n :: Symbol) String 
Instance details

Defined in Data.Reflection

Methods

reflect :: proxy n -> String #

Reifies Z Int 
Instance details

Defined in Data.Reflection

Methods

reflect :: proxy Z -> Int #

Reifies n Int => Reifies (D n :: *) Int 
Instance details

Defined in Data.Reflection

Methods

reflect :: proxy (D n) -> Int #

Reifies n Int => Reifies (SD n :: *) Int 
Instance details

Defined in Data.Reflection

Methods

reflect :: proxy (SD n) -> Int #

Reifies n Int => Reifies (PD n :: *) Int 
Instance details

Defined in Data.Reflection

Methods

reflect :: proxy (PD n) -> Int #

(B b0, B b1, B b2, B b3, B b4, B b5, B b6, B b7, w0 ~ W b0 b1 b2 b3, w1 ~ W b4 b5 b6 b7) => Reifies (Stable w0 w1 a :: *) a 
Instance details

Defined in Data.Reflection

Methods

reflect :: proxy (Stable w0 w1 a) -> a #

reify :: a -> (forall s. Reifies s a => Proxy s -> r) -> r #

Reify a value at the type level, to be recovered with reflect.

reifyNat :: Integer -> (forall (n :: Nat). KnownNat n => Proxy n -> r) -> r #

This upgraded version of reify can be used to generate a KnownNat suitable for use with other APIs.

Available only on GHC 7.8+

>>> reifyNat 4 natVal
4
>>> reifyNat 4 reflect
4

reifySymbol :: String -> (forall (n :: Symbol). KnownSymbol n => Proxy n -> r) -> r #

This upgraded version of reify can be used to generate a KnownSymbol suitable for use with other APIs.

Available only on GHC 7.8+

>>> reifySymbol "hello" symbolVal
"hello"
>>> reifySymbol "hello" reflect
"hello"

reifyTypeable :: Typeable a => a -> (forall s. (Typeable s, Reifies s a) => Proxy s -> r) -> r #

Reify a value at the type level in a Typeable-compatible fashion, to be recovered with reflect.

This can be necessary to work around the changes to Data.Typeable in GHC HEAD.