Portability | non-portable (rank-2 types) |
---|---|
Stability | experimental |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Safe Haskell | Safe-Infered |
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.
- class Reified s where
- reflect :: proxy (s a) -> a
- reify :: a -> (forall s. Reified s => Proxy (s a) -> w) -> w
- reflectT :: Reified s => t s a -> a
- class ReifiedNum s where
- reflectNum :: Num a => proxy s -> a
- reifyIntegral :: Integral a => a -> (forall s. ReifiedNum s => Proxy s -> w) -> w
- class ReifiedNums ss where
- reflectNums :: Num a => proxy ss -> [a]
- reifyIntegrals :: Integral a => [a] -> (forall ss. ReifiedNums ss => Proxy ss -> w) -> w
- class ReifiedStorable s where
- reflectStorable :: Storable a => proxy (s a) -> a
- reifyStorable :: Storable a => a -> (forall s. ReifiedStorable s => Proxy (s a) -> w) -> w
Reifying any term at the type level
Special cases
Reifying integral values as types
class ReifiedNum s whereSource
reflectNum :: Num a => proxy s -> aSource
ReifiedNum Zero | |
ReifiedNum s => ReifiedNum (Pred s) | |
ReifiedNum s => ReifiedNum (Succ s) | |
ReifiedNum s => ReifiedNum (Twice s) |
reifyIntegral :: Integral a => a -> (forall s. ReifiedNum s => Proxy s -> w) -> wSource
Reifying lists of integrals values as types
class ReifiedNums ss whereSource
reflectNums :: Num a => proxy ss -> [a]Source
ReifiedNums Nil | |
(ReifiedNum s, ReifiedNums ss) => ReifiedNums (Cons s ss) |
reifyIntegrals :: Integral a => [a] -> (forall ss. ReifiedNums ss => Proxy ss -> w) -> wSource
Reifying storables values as types
class ReifiedStorable s whereSource
reflectStorable :: Storable a => proxy (s a) -> aSource
ReifiedNums s => ReifiedStorable (Store s) |
reifyStorable :: Storable a => a -> (forall s. ReifiedStorable s => Proxy (s a) -> w) -> wSource