-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Reifies arbitrary terms into types that can be reflected back into terms
--   
--   This package addresses the <i>configuration problem</i> which is
--   propagating configurations that are available at run-time, allowing
--   multiple configurations to coexist without resorting to mutable global
--   variables or <a>System.IO.Unsafe.unsafePerformIO</a>.
--   
--   That package is an implementation of the ideas presented in the paper
--   "Functional Pearl: Implicit Configurations" by Oleg Kiselyov and
--   Chung-chieh Shan (<a>original paper</a>). However, the API has been
--   streamlined to improve performance.
--   
--   Austin Seipp's tutorial <a>Reflecting values to types and back</a>
--   provides a summary of the approach taken by this library, along with
--   more motivating examples.
@package reflection
@version 2.1.2


-- | Reifies arbitrary terms at the type level. Based on the Functional
--   Pearl: Implicit Configurations paper by Oleg Kiselyov and Chung-chieh
--   Shan.
--   
--   <a>http://okmij.org/ftp/Haskell/tr-15-04.pdf</a>
--   
--   The approach from the paper was modified to work with Data.Proxy and
--   to cheat by using knowledge of GHC's internal representations by
--   Edward Kmett and Elliott Hird.
--   
--   Usage comes down to two combinators, <a>reify</a> and <a>reflect</a>.
--   
--   <pre>
--   &gt;&gt;&gt; reify 6 (\p -&gt; reflect p + reflect p)
--   12
--   </pre>
--   
--   The argument passed along by reify is just a <tt>data <a>Proxy</a> t =
--   Proxy</tt>, so all of the information needed to reconstruct your value
--   has been moved to the type level. This enables it to be used when
--   constructing instances (see <tt>examples/Monoid.hs</tt>).
--   
--   In addition, a simpler API is offered for working with singleton
--   values such as a system configuration, etc.
module Data.Reflection
class Reifies s a | s -> a

-- | Recover a value inside a <a>reify</a> context, given a proxy for its
--   reified type.
reflect :: Reifies s a => proxy s -> a

-- | Reify a value at the type level, to be recovered with <a>reflect</a>.
reify :: forall a r. a -> (forall (s :: *). Reifies s a => Proxy s -> r) -> r

-- | This upgraded version of <a>reify</a> can be used to generate a
--   <a>KnownNat</a> suitable for use with other APIs.
--   
--   <i>Available only on GHC 7.8+</i>
--   
--   <pre>
--   &gt;&gt;&gt; reifyNat 4 natVal
--   4
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; reifyNat 4 reflect
--   4
--   </pre>
reifyNat :: forall r. Integer -> (forall (n :: Nat). KnownNat n => Proxy n -> r) -> r

-- | This upgraded version of <a>reify</a> can be used to generate a
--   <a>KnownSymbol</a> suitable for use with other APIs.
--   
--   <i>Available only on GHC 7.8+</i>
--   
--   <pre>
--   &gt;&gt;&gt; reifySymbol "hello" symbolVal
--   "hello"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; reifySymbol "hello" reflect
--   "hello"
--   </pre>
reifySymbol :: forall r. String -> (forall (n :: Symbol). KnownSymbol n => Proxy n -> r) -> r

-- | Reify a value at the type level in a <a>Typeable</a>-compatible
--   fashion, to be recovered with <a>reflect</a>.
--   
--   This can be necessary to work around the changes to
--   <tt>Data.Typeable</tt> in GHC HEAD.
reifyTypeable :: Typeable a => a -> (forall (s :: *). (Typeable s, Reifies s a) => Proxy s -> r) -> r

-- | This is a version of <a>Reifies</a> that allows for only a single
--   value.
--   
--   This is easier to work with than <a>Reifies</a> and permits extended
--   defaulting, but it only offers a single reflected value of a given
--   type at a time.
class Given a

-- | Recover the value of a given type previously encoded with <a>give</a>.
given :: Given a => a

-- | Reify a value into an instance to be recovered with <a>given</a>.
--   
--   You should <i>only</i> <a>give</a> a single value for each type. If
--   multiple instances are in scope, then the behavior is implementation
--   defined.
give :: forall a r. a -> (Given a => r) -> r

-- | This can be used to generate a template haskell splice for a type
--   level version of a given <a>int</a>.
--   
--   This does not use GHC TypeLits, instead it generates a numeric type by
--   hand similar to the ones used in the "Functional Pearl: Implicit
--   Configurations" paper by Oleg Kiselyov and Chung-Chieh Shan.
--   
--   <tt>instance Num (Q Exp)</tt> provided in this package allows writing
--   <tt>$(3)</tt> instead of <tt>$(int 3)</tt>. Sometimes the two will
--   produce the same representation (if compiled without the
--   <tt>-DUSE_TYPE_LITS</tt> preprocessor directive).
int :: Int -> TypeQ

-- | This is a restricted version of <a>int</a> that can only generate
--   natural numbers. Attempting to generate a negative number results in a
--   compile time error. Also the resulting sequence will consist entirely
--   of Z, D, and SD constructors representing the number in zeroless
--   binary.
nat :: Int -> TypeQ
data Z
data D (n :: *)
data SD (n :: *)
data PD (n :: *)
data ReifiedMonoid a
ReifiedMonoid :: (a -> a -> a) -> a -> ReifiedMonoid a
[reifiedMappend] :: ReifiedMonoid a -> a -> a -> a
[reifiedMempty] :: ReifiedMonoid a -> a
newtype ReflectedMonoid a s
ReflectedMonoid :: a -> ReflectedMonoid a s
reifyMonoid :: (a -> a -> a) -> a -> (forall (s :: *). Reifies s (ReifiedMonoid a) => t -> ReflectedMonoid a s) -> t -> a

-- | Fold a value using its <a>Foldable</a> instance using explicitly
--   provided <a>Monoid</a> operations. This is like <a>foldMap</a> where
--   the <a>Monoid</a> instance can be manually specified.
--   
--   <pre>
--   <a>foldMapBy</a> <a>mappend</a> <a>mempty</a> ≡ <a>foldMap</a>
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; foldMapBy (+) 0 length ["hello","world"]
--   10
--   </pre>
foldMapBy :: Foldable t => (r -> r -> r) -> r -> (a -> r) -> t a -> r

-- | Fold a value using its <a>Foldable</a> instance using explicitly
--   provided <a>Monoid</a> operations. This is like <tt>fold</tt> where
--   the <a>Monoid</a> instance can be manually specified.
--   
--   <pre>
--   <a>foldBy</a> <a>mappend</a> <a>mempty</a> ≡ <tt>fold</tt>
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; foldBy (++) [] ["hello","world"]
--   "helloworld"
--   </pre>
foldBy :: Foldable t => (a -> a -> a) -> a -> t a -> a
data ReifiedApplicative f
ReifiedApplicative :: (forall a. a -> f a) -> (forall a b. f (a -> b) -> f a -> f b) -> ReifiedApplicative f
[reifiedPure] :: ReifiedApplicative f -> forall a. a -> f a
[reifiedAp] :: ReifiedApplicative f -> forall a b. f (a -> b) -> f a -> f b
newtype ReflectedApplicative f s a
ReflectedApplicative :: (f a) -> ReflectedApplicative f s a
reifyApplicative :: (forall x. x -> f x) -> (forall x y. f (x -> y) -> f x -> f y) -> (forall (s :: *). Reifies s (ReifiedApplicative f) => t -> ReflectedApplicative f s a) -> t -> f a

-- | Traverse a container using its <a>Traversable</a> instance using
--   explicitly provided <a>Applicative</a> operations. This is like
--   <a>traverse</a> where the <a>Applicative</a> instance can be manually
--   specified.
traverseBy :: Traversable t => (forall x. x -> f x) -> (forall x y. f (x -> y) -> f x -> f y) -> (a -> f b) -> t a -> f (t b)

-- | Sequence a container using its <a>Traversable</a> instance using
--   explicitly provided <a>Applicative</a> operations. This is like
--   <a>sequence</a> where the <a>Applicative</a> instance can be manually
--   specified.
sequenceBy :: Traversable t => (forall x. x -> f x) -> (forall x y. f (x -> y) -> f x -> f y) -> t (f a) -> f (t a)
instance GHC.TypeLits.KnownNat n => Data.Reflection.Reifies n GHC.Integer.Type.Integer
instance GHC.TypeLits.KnownSymbol n => Data.Reflection.Reifies n GHC.Base.String
instance Data.Reflection.Reifies Data.Reflection.Z GHC.Types.Int
instance Data.Reflection.Reifies n GHC.Types.Int => Data.Reflection.Reifies (Data.Reflection.D n) GHC.Types.Int
instance Data.Reflection.Reifies n GHC.Types.Int => Data.Reflection.Reifies (Data.Reflection.SD n) GHC.Types.Int
instance Data.Reflection.Reifies n GHC.Types.Int => Data.Reflection.Reifies (Data.Reflection.PD n) GHC.Types.Int
instance GHC.Num.Num a => GHC.Num.Num (Language.Haskell.TH.Syntax.Q a)
instance GHC.Real.Fractional a => GHC.Real.Fractional (Language.Haskell.TH.Syntax.Q a)
instance GHC.Num.Num Language.Haskell.TH.Syntax.Type
instance GHC.Num.Num Language.Haskell.TH.Syntax.Exp
instance Data.Reflection.B Data.Reflection.T0
instance Data.Reflection.B Data.Reflection.T1
instance Data.Reflection.B Data.Reflection.T2
instance Data.Reflection.B Data.Reflection.T3
instance Data.Reflection.B Data.Reflection.T4
instance Data.Reflection.B Data.Reflection.T5
instance Data.Reflection.B Data.Reflection.T6
instance Data.Reflection.B Data.Reflection.T7
instance Data.Reflection.B Data.Reflection.T8
instance Data.Reflection.B Data.Reflection.T9
instance Data.Reflection.B Data.Reflection.T10
instance Data.Reflection.B Data.Reflection.T11
instance Data.Reflection.B Data.Reflection.T12
instance Data.Reflection.B Data.Reflection.T13
instance Data.Reflection.B Data.Reflection.T14
instance Data.Reflection.B Data.Reflection.T15
instance Data.Reflection.B Data.Reflection.T16
instance Data.Reflection.B Data.Reflection.T17
instance Data.Reflection.B Data.Reflection.T18
instance Data.Reflection.B Data.Reflection.T19
instance Data.Reflection.B Data.Reflection.T20
instance Data.Reflection.B Data.Reflection.T21
instance Data.Reflection.B Data.Reflection.T22
instance Data.Reflection.B Data.Reflection.T23
instance Data.Reflection.B Data.Reflection.T24
instance Data.Reflection.B Data.Reflection.T25
instance Data.Reflection.B Data.Reflection.T26
instance Data.Reflection.B Data.Reflection.T27
instance Data.Reflection.B Data.Reflection.T28
instance Data.Reflection.B Data.Reflection.T29
instance Data.Reflection.B Data.Reflection.T30
instance Data.Reflection.B Data.Reflection.T31
instance Data.Reflection.B Data.Reflection.T32
instance Data.Reflection.B Data.Reflection.T33
instance Data.Reflection.B Data.Reflection.T34
instance Data.Reflection.B Data.Reflection.T35
instance Data.Reflection.B Data.Reflection.T36
instance Data.Reflection.B Data.Reflection.T37
instance Data.Reflection.B Data.Reflection.T38
instance Data.Reflection.B Data.Reflection.T39
instance Data.Reflection.B Data.Reflection.T40
instance Data.Reflection.B Data.Reflection.T41
instance Data.Reflection.B Data.Reflection.T42
instance Data.Reflection.B Data.Reflection.T43
instance Data.Reflection.B Data.Reflection.T44
instance Data.Reflection.B Data.Reflection.T45
instance Data.Reflection.B Data.Reflection.T46
instance Data.Reflection.B Data.Reflection.T47
instance Data.Reflection.B Data.Reflection.T48
instance Data.Reflection.B Data.Reflection.T49
instance Data.Reflection.B Data.Reflection.T50
instance Data.Reflection.B Data.Reflection.T51
instance Data.Reflection.B Data.Reflection.T52
instance Data.Reflection.B Data.Reflection.T53
instance Data.Reflection.B Data.Reflection.T54
instance Data.Reflection.B Data.Reflection.T55
instance Data.Reflection.B Data.Reflection.T56
instance Data.Reflection.B Data.Reflection.T57
instance Data.Reflection.B Data.Reflection.T58
instance Data.Reflection.B Data.Reflection.T59
instance Data.Reflection.B Data.Reflection.T60
instance Data.Reflection.B Data.Reflection.T61
instance Data.Reflection.B Data.Reflection.T62
instance Data.Reflection.B Data.Reflection.T63
instance Data.Reflection.B Data.Reflection.T64
instance Data.Reflection.B Data.Reflection.T65
instance Data.Reflection.B Data.Reflection.T66
instance Data.Reflection.B Data.Reflection.T67
instance Data.Reflection.B Data.Reflection.T68
instance Data.Reflection.B Data.Reflection.T69
instance Data.Reflection.B Data.Reflection.T70
instance Data.Reflection.B Data.Reflection.T71
instance Data.Reflection.B Data.Reflection.T72
instance Data.Reflection.B Data.Reflection.T73
instance Data.Reflection.B Data.Reflection.T74
instance Data.Reflection.B Data.Reflection.T75
instance Data.Reflection.B Data.Reflection.T76
instance Data.Reflection.B Data.Reflection.T77
instance Data.Reflection.B Data.Reflection.T78
instance Data.Reflection.B Data.Reflection.T79
instance Data.Reflection.B Data.Reflection.T80
instance Data.Reflection.B Data.Reflection.T81
instance Data.Reflection.B Data.Reflection.T82
instance Data.Reflection.B Data.Reflection.T83
instance Data.Reflection.B Data.Reflection.T84
instance Data.Reflection.B Data.Reflection.T85
instance Data.Reflection.B Data.Reflection.T86
instance Data.Reflection.B Data.Reflection.T87
instance Data.Reflection.B Data.Reflection.T88
instance Data.Reflection.B Data.Reflection.T89
instance Data.Reflection.B Data.Reflection.T90
instance Data.Reflection.B Data.Reflection.T91
instance Data.Reflection.B Data.Reflection.T92
instance Data.Reflection.B Data.Reflection.T93
instance Data.Reflection.B Data.Reflection.T94
instance Data.Reflection.B Data.Reflection.T95
instance Data.Reflection.B Data.Reflection.T96
instance Data.Reflection.B Data.Reflection.T97
instance Data.Reflection.B Data.Reflection.T98
instance Data.Reflection.B Data.Reflection.T99
instance Data.Reflection.B Data.Reflection.T100
instance Data.Reflection.B Data.Reflection.T101
instance Data.Reflection.B Data.Reflection.T102
instance Data.Reflection.B Data.Reflection.T103
instance Data.Reflection.B Data.Reflection.T104
instance Data.Reflection.B Data.Reflection.T105
instance Data.Reflection.B Data.Reflection.T106
instance Data.Reflection.B Data.Reflection.T107
instance Data.Reflection.B Data.Reflection.T108
instance Data.Reflection.B Data.Reflection.T109
instance Data.Reflection.B Data.Reflection.T110
instance Data.Reflection.B Data.Reflection.T111
instance Data.Reflection.B Data.Reflection.T112
instance Data.Reflection.B Data.Reflection.T113
instance Data.Reflection.B Data.Reflection.T114
instance Data.Reflection.B Data.Reflection.T115
instance Data.Reflection.B Data.Reflection.T116
instance Data.Reflection.B Data.Reflection.T117
instance Data.Reflection.B Data.Reflection.T118
instance Data.Reflection.B Data.Reflection.T119
instance Data.Reflection.B Data.Reflection.T120
instance Data.Reflection.B Data.Reflection.T121
instance Data.Reflection.B Data.Reflection.T122
instance Data.Reflection.B Data.Reflection.T123
instance Data.Reflection.B Data.Reflection.T124
instance Data.Reflection.B Data.Reflection.T125
instance Data.Reflection.B Data.Reflection.T126
instance Data.Reflection.B Data.Reflection.T127
instance Data.Reflection.B Data.Reflection.T128
instance Data.Reflection.B Data.Reflection.T129
instance Data.Reflection.B Data.Reflection.T130
instance Data.Reflection.B Data.Reflection.T131
instance Data.Reflection.B Data.Reflection.T132
instance Data.Reflection.B Data.Reflection.T133
instance Data.Reflection.B Data.Reflection.T134
instance Data.Reflection.B Data.Reflection.T135
instance Data.Reflection.B Data.Reflection.T136
instance Data.Reflection.B Data.Reflection.T137
instance Data.Reflection.B Data.Reflection.T138
instance Data.Reflection.B Data.Reflection.T139
instance Data.Reflection.B Data.Reflection.T140
instance Data.Reflection.B Data.Reflection.T141
instance Data.Reflection.B Data.Reflection.T142
instance Data.Reflection.B Data.Reflection.T143
instance Data.Reflection.B Data.Reflection.T144
instance Data.Reflection.B Data.Reflection.T145
instance Data.Reflection.B Data.Reflection.T146
instance Data.Reflection.B Data.Reflection.T147
instance Data.Reflection.B Data.Reflection.T148
instance Data.Reflection.B Data.Reflection.T149
instance Data.Reflection.B Data.Reflection.T150
instance Data.Reflection.B Data.Reflection.T151
instance Data.Reflection.B Data.Reflection.T152
instance Data.Reflection.B Data.Reflection.T153
instance Data.Reflection.B Data.Reflection.T154
instance Data.Reflection.B Data.Reflection.T155
instance Data.Reflection.B Data.Reflection.T156
instance Data.Reflection.B Data.Reflection.T157
instance Data.Reflection.B Data.Reflection.T158
instance Data.Reflection.B Data.Reflection.T159
instance Data.Reflection.B Data.Reflection.T160
instance Data.Reflection.B Data.Reflection.T161
instance Data.Reflection.B Data.Reflection.T162
instance Data.Reflection.B Data.Reflection.T163
instance Data.Reflection.B Data.Reflection.T164
instance Data.Reflection.B Data.Reflection.T165
instance Data.Reflection.B Data.Reflection.T166
instance Data.Reflection.B Data.Reflection.T167
instance Data.Reflection.B Data.Reflection.T168
instance Data.Reflection.B Data.Reflection.T169
instance Data.Reflection.B Data.Reflection.T170
instance Data.Reflection.B Data.Reflection.T171
instance Data.Reflection.B Data.Reflection.T172
instance Data.Reflection.B Data.Reflection.T173
instance Data.Reflection.B Data.Reflection.T174
instance Data.Reflection.B Data.Reflection.T175
instance Data.Reflection.B Data.Reflection.T176
instance Data.Reflection.B Data.Reflection.T177
instance Data.Reflection.B Data.Reflection.T178
instance Data.Reflection.B Data.Reflection.T179
instance Data.Reflection.B Data.Reflection.T180
instance Data.Reflection.B Data.Reflection.T181
instance Data.Reflection.B Data.Reflection.T182
instance Data.Reflection.B Data.Reflection.T183
instance Data.Reflection.B Data.Reflection.T184
instance Data.Reflection.B Data.Reflection.T185
instance Data.Reflection.B Data.Reflection.T186
instance Data.Reflection.B Data.Reflection.T187
instance Data.Reflection.B Data.Reflection.T188
instance Data.Reflection.B Data.Reflection.T189
instance Data.Reflection.B Data.Reflection.T190
instance Data.Reflection.B Data.Reflection.T191
instance Data.Reflection.B Data.Reflection.T192
instance Data.Reflection.B Data.Reflection.T193
instance Data.Reflection.B Data.Reflection.T194
instance Data.Reflection.B Data.Reflection.T195
instance Data.Reflection.B Data.Reflection.T196
instance Data.Reflection.B Data.Reflection.T197
instance Data.Reflection.B Data.Reflection.T198
instance Data.Reflection.B Data.Reflection.T199
instance Data.Reflection.B Data.Reflection.T200
instance Data.Reflection.B Data.Reflection.T201
instance Data.Reflection.B Data.Reflection.T202
instance Data.Reflection.B Data.Reflection.T203
instance Data.Reflection.B Data.Reflection.T204
instance Data.Reflection.B Data.Reflection.T205
instance Data.Reflection.B Data.Reflection.T206
instance Data.Reflection.B Data.Reflection.T207
instance Data.Reflection.B Data.Reflection.T208
instance Data.Reflection.B Data.Reflection.T209
instance Data.Reflection.B Data.Reflection.T210
instance Data.Reflection.B Data.Reflection.T211
instance Data.Reflection.B Data.Reflection.T212
instance Data.Reflection.B Data.Reflection.T213
instance Data.Reflection.B Data.Reflection.T214
instance Data.Reflection.B Data.Reflection.T215
instance Data.Reflection.B Data.Reflection.T216
instance Data.Reflection.B Data.Reflection.T217
instance Data.Reflection.B Data.Reflection.T218
instance Data.Reflection.B Data.Reflection.T219
instance Data.Reflection.B Data.Reflection.T220
instance Data.Reflection.B Data.Reflection.T221
instance Data.Reflection.B Data.Reflection.T222
instance Data.Reflection.B Data.Reflection.T223
instance Data.Reflection.B Data.Reflection.T224
instance Data.Reflection.B Data.Reflection.T225
instance Data.Reflection.B Data.Reflection.T226
instance Data.Reflection.B Data.Reflection.T227
instance Data.Reflection.B Data.Reflection.T228
instance Data.Reflection.B Data.Reflection.T229
instance Data.Reflection.B Data.Reflection.T230
instance Data.Reflection.B Data.Reflection.T231
instance Data.Reflection.B Data.Reflection.T232
instance Data.Reflection.B Data.Reflection.T233
instance Data.Reflection.B Data.Reflection.T234
instance Data.Reflection.B Data.Reflection.T235
instance Data.Reflection.B Data.Reflection.T236
instance Data.Reflection.B Data.Reflection.T237
instance Data.Reflection.B Data.Reflection.T238
instance Data.Reflection.B Data.Reflection.T239
instance Data.Reflection.B Data.Reflection.T240
instance Data.Reflection.B Data.Reflection.T241
instance Data.Reflection.B Data.Reflection.T242
instance Data.Reflection.B Data.Reflection.T243
instance Data.Reflection.B Data.Reflection.T244
instance Data.Reflection.B Data.Reflection.T245
instance Data.Reflection.B Data.Reflection.T246
instance Data.Reflection.B Data.Reflection.T247
instance Data.Reflection.B Data.Reflection.T248
instance Data.Reflection.B Data.Reflection.T249
instance Data.Reflection.B Data.Reflection.T250
instance Data.Reflection.B Data.Reflection.T251
instance Data.Reflection.B Data.Reflection.T252
instance Data.Reflection.B Data.Reflection.T253
instance Data.Reflection.B Data.Reflection.T254
instance Data.Reflection.B Data.Reflection.T255
instance (Data.Reflection.B b0, Data.Reflection.B b1, Data.Reflection.B b2, Data.Reflection.B b3, Data.Reflection.B b4, Data.Reflection.B b5, Data.Reflection.B b6, Data.Reflection.B b7, w0 ~ Data.Reflection.W b0 b1 b2 b3, w1 ~ Data.Reflection.W b4 b5 b6 b7) => Data.Reflection.Reifies (Data.Reflection.Stable w0 w1 a) a
instance forall k (s :: k) a. Data.Reflection.Reifies s (Data.Reflection.ReifiedMonoid a) => GHC.Base.Monoid (Data.Reflection.ReflectedMonoid a s)
instance forall k (s :: k) (f :: * -> *). Data.Reflection.Reifies s (Data.Reflection.ReifiedApplicative f) => GHC.Base.Functor (Data.Reflection.ReflectedApplicative f s)
instance forall k (s :: k) (f :: * -> *). Data.Reflection.Reifies s (Data.Reflection.ReifiedApplicative f) => GHC.Base.Applicative (Data.Reflection.ReflectedApplicative f s)
