reflection-0.5: Functional Pearl: Implicit Configurations

Portabilitynon-portable (scoped types, MPTCs, rank-n, FFI, kinds)
Stabilityexperimental
MaintainerEdward Kmett <ekmett@gmail.com>

Data.Reflection

Contents

Description

Based on the Functional Pearl: Implicit Configurations paper by Oleg Kiselyov and Chung-chieh Shan.

http://www.cs.rutgers.edu/~ccshan/prepose/prepose.pdf

Modified to minimize extensions and work with Data.Proxy rather than explicit scoped type variables and undefined values by Edward Kmett.

Synopsis

Reflect Integrals

class ReifiesNum s whereSource

Methods

reflectNum :: Num a => proxy s -> aSource

Instances

ReifiesNum Zero 
ReifiesNum s => ReifiesNum (Pred s) 
ReifiesNum s => ReifiesNum (Succ s) 
ReifiesNum s => ReifiesNum (Twice s) 

reifyIntegral :: Integral a => a -> (forall s. ReifiesNum s => Proxy s -> w) -> wSource

Reflect Lists of Integrals

class ReifiesNums ss whereSource

Methods

reflectNums :: Num a => proxy ss -> [a]Source

Instances

ReifiesNums Nil 
(ReifiesNum s, ReifiesNums ss) => ReifiesNums (Cons s ss) 

reifyIntegrals :: Integral a => [a] -> (forall ss. ReifiesNums ss => Proxy ss -> w) -> wSource

Reflect Storables

class ReifiesStorable s whereSource

Methods

reflectStorable :: Storable a => proxy (s a) -> aSource

Instances

ReifiesNums s => ReifiesStorable (Store s) 

reifyStorable :: Storable a => a -> (forall s. ReifiesStorable s => Proxy (s a) -> w) -> wSource

Reflect Anything

class Reifies s a | s -> a whereSource

Methods

reflect :: proxy s -> aSource

Instances

ReifiesStorable s => Reifies (Stable s a) a 

reify :: a -> (forall s. Reifies s a => Proxy s -> w) -> wSource