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


-- | Selectors for reading and updating data.
--   
--   References are data accessors that can read, write or update the
--   accessed infromation through their context. They are first-class
--   values, can be passed in functions, transformed, combined. References
--   generalize lenses, folds and traversals for haskell (see:
--   <a>https://hackage.haskell.org/package/lens</a>).
--   
--   References are more general than field selectors in traditional
--   languages.
--   
--   <ul>
--   <li>References are first-class values. If there is a struct in C, for
--   example, with an <a>int</a> field <a>fl</a>, then fl can only be used
--   as part of an expression. One can not generalize a function to take a
--   field selector and transform the selected data or use it in other
--   ways.</li>
--   <li>They can have different meanings, while field accessors can only
--   represent data-level containment. They can express uncertain
--   containment (like field selectors of C unions), different viewpoints
--   of the same data, and other concepts.</li>
--   </ul>
--   
--   There are two things that references can do but the previously
--   mentioned access methods don't.
--   
--   <ul>
--   <li>References can cooperate with monads, for example IO. This opens
--   many new applications.</li>
--   <li>References can be added using the <tt>&amp;+&amp;</tt> operator,
--   to create new lenses more easily.</li>
--   </ul>
--   
--   Basic idea taken from the currently not maintained package
--   <a>https://hackage.haskell.org/package/yall</a>.
--   
--   An example use of the references (a logger application that spawns new
--   threads to update a global log):
--   
--   <pre>
--   logger =
--     (forever $ do
--        log &lt;- logChan ^? chan&amp;logRecord    -- Extract the log record from the received log message
--        thrId &lt;- forkIO (do time &lt;- getTime
--                            ioref&amp;lastLogTime != time $ logDB     -- Update the last logging time mutable log database
--                            let logMsg = senderThread .- show     -- Transform the thread id to a string and
--                                           $ loggingTime .= time  -- update the time
--                                           $ log                  -- inside the log message
--                            ioref&amp;debugInfos !~ addLogEntry log $ logDB  -- update the table of log entries
--                            mvar !- (+1) $ count )
--        mvar !- (thrId:) $ updaters                               -- Record the spawned thread
--       ) `catch` stopUpdaters updaters
--     where stopUpdaters updaters ThreadKilled =
--             mvar&amp;traverse !| killThread $ updaters               -- Kill all spawned threads before stopping
--   </pre>
--   
--   There are a bunch of predefined references for datatypes included in
--   standard libraries.
--   
--   New references can be created in several ways:
--   
--   <ul>
--   <li>From getter, setter and updater, using the <tt>reference</tt>
--   function.</li>
--   <li>From getter and setter, using one of the simplified functions
--   (<tt>lens</tt>, <tt>simplePartial</tt>, <tt>partial</tt>, ...).</li>
--   <li>Using the <a>Data.Traversal</a> instance on a datatype to generate
--   a traversal of each element.</li>
--   <li>Using lenses from <a>Control.Lens</a> package. There are a lot of
--   packages defining lenses, folds and traversals for various data
--   structures, so it is very useful that all of them can simply be
--   converted into a reference.</li>
--   <li>Generating references for newly defined datatypes using the
--   <a>makeReferences</a> Template Haskell function.</li>
--   </ul>
@package references
@version 0.3.3.1


-- | This module declares the representation and basic classes of
--   references. Supplies primitive functions to create references.
--   
--   This module should not be imported directly.
module Control.Reference.Representation

-- | A reference is an accessor to a part or different view of some data.
--   The referenc has a separate getter, setter and updater. In some cases,
--   the semantics are a bit different
data Reference w r w' r' s t a b
Reference :: (forall x. (a -> r x) -> s -> r x) -> (b -> s -> w t) -> ((a -> w b) -> s -> w t) -> (forall x. (s -> r' x) -> a -> r' x) -> (t -> a -> w' b) -> ((s -> w' t) -> a -> w' b) -> Reference w r w' r' s t a b

-- | Getter for the lens. Takes a monadic function and runs it on the
--   accessed value. This is necessary to run actions after a read.
[refGet] :: Reference w r w' r' s t a b -> forall x. (a -> r x) -> s -> r x

-- | Setter for the lens
[refSet] :: Reference w r w' r' s t a b -> b -> s -> w t

-- | Updater for the lens. Handles monadic update functions.
[refUpdate] :: Reference w r w' r' s t a b -> (a -> w b) -> s -> w t
[refGet'] :: Reference w r w' r' s t a b -> forall x. (s -> r' x) -> a -> r' x
[refSet'] :: Reference w r w' r' s t a b -> t -> a -> w' b
[refUpdate'] :: Reference w r w' r' s t a b -> (s -> w' t) -> a -> w' b
type IndexedReference i w r w' r' s t a b = i -> Reference w r w' r' s t a b
bireference :: (RefMonads w r, RefMonads w' r') => (s -> r a) -> (b -> s -> w t) -> ((a -> w b) -> s -> w t) -> (a -> r' s) -> (t -> a -> w' b) -> ((s -> w' t) -> a -> w' b) -> Reference w r w' r' s t a b

-- | Creates a reference.
reference :: RefMonads w r => (s -> r a) -> (b -> s -> w t) -> ((a -> w b) -> s -> w t) -> Reference w r MU MU s t a b

-- | Creates a reference where all operations are added in their original
--   form.
--   
--   The use of this method is not suggested, because it is closely related
--   to the representation of the references.
rawReference :: (RefMonads w r, RefMonads w' r') => (forall x. (a -> r x) -> s -> r x) -> (b -> s -> w t) -> ((a -> w b) -> s -> w t) -> (forall x. (s -> r' x) -> a -> r' x) -> (t -> a -> w' b) -> ((s -> w' t) -> a -> w' b) -> Reference w r w' r' s t a b

-- | Creates a reference with explicit close operations that are executed
--   after the data is accessed.
referenceWithClose :: RefMonads w r => (s -> r a) -> (s -> r ()) -> (b -> s -> w t) -> (s -> w ()) -> ((a -> w b) -> s -> w t) -> (s -> w ()) -> Reference w r MU MU s t a b

-- | A simple class to enforce that both reader and writer semantics of the
--   reference are <a>Monad</a>s (as well as <a>Applicative</a>s and
--   <a>Functor</a>s)
type RefMonads w r = (Functor w, Applicative w, Monad w, Functor r, Applicative r, Monad r)
type MU = Proxy
unusableOp :: a -> b -> MU c


-- | Operators to combine and transform references.
module Control.Reference.Combinators

-- | Composes two references. They must be of the same kind.
--   
--   If reference <tt>r</tt> accesses <tt>b</tt> inside the context
--   <tt>a</tt>, and reference <tt>p</tt> accesses <tt>c</tt> inside the
--   context <tt>b</tt>, than the reference <tt>r&amp;p</tt> will access
--   <tt>c</tt> inside <tt>a</tt>.
--   
--   Composition is associative: <tt> (r&amp;p)&amp;q = r&amp;(p&amp;q)
--   </tt>
(&) :: (Monad w, Monad r) => Reference w r w' r' s t c d -> Reference w r w' r' c d a b -> Reference w r w' r' s t a b
infixl 6 &

-- | Adds two references.
--   
--   Using this operator may result in accessing the same parts of data
--   multiple times. For example <tt> twice = self &amp;+&amp; self </tt>
--   is a reference that accesses itself twice:
--   
--   <pre>
--   a ^? twice == [a,a]
--   (twice *= x) a == x
--   (twice .- f) a == f (f a)
--   </pre>
--   
--   Addition is commutative only if we do not consider the order of the
--   results from a get, or the order in which monadic actions are
--   performed.
(&+&) :: (RefMonads w r, RefMonads w' r', MonadPlus r, MonadPlus r', Morph [] r) => Reference w r w' r' s s a a -> Reference w r w' r' s s a a -> Reference w r w' r' s s a a
infixl 5 &+&

-- | Pack two references in parallel.
(&|&) :: RefMonads m m' => Reference m m m' m' s t a b -> Reference m m m' m' s' t' a' b' -> Reference m m m' m' (s, s') (t, t') (a, a') (b, b')
infixl 5 &|&

-- | Flips a reference to the other direction. The monads of the references
--   can change when a reference is turned.
turn :: Reference w r w' r' s t a b -> Reference w' r' w r a b s t


-- | This module defines the polymorphic types of the created references.
--   The actual type of a reference can be different for every usage, the
--   polymorphic type gives a lower bound on the actual one.
module Control.Reference.Types

-- | A monomorph <a>Lens</a>, <a>Traversal</a>, <a>Partial</a>, etc...
--   Setting or updating does not change the type of the base.
type Simple t s a = t s s a a
type Getter r s t a b = Reference MU r MU MU s t a b
type Setter w s t a b = Reference w MU MU MU s t a b

-- | A two-way <a>Reference</a> that represents an isomorphism between two
--   datatypes. Can be used to access the same data in two different
--   representations.
type Iso s t a b = forall w r w' r'. (RefMonads w r, RefMonads w' r') => Reference w r w' r' s t a b

-- | A partial lens that can be turned to get a total lens.
type Prism s t a b = forall w r w' r'. (RefMonads w r, RefMonads w' r', MonadPlus r, Morph Maybe r, MonadPlus w', Morph Maybe w') => Reference w r w' r' s t a b

-- | A <a>Reference</a> that can access a part of data that exists in the
--   context. A <a>Lens</a> can have any read and write semantics that a
--   <a>Reference</a> can have.
type Lens s t a b = forall w r. RefMonads w r => Reference w r MU MU s t a b

-- | A reference that may not have the accessed element, and that can look
--   for the accessed element in multiple locations.
type RefPlus s t a b = forall w r. (RefMonads w r, MonadPlus r) => Reference w r MU MU s t a b

-- | Partial lens. A <a>Reference</a> that can access data that may not
--   exist in the context. Every lens is a partial lens.
--   
--   Any reference that is a partial lens should only perform the action
--   given to its <tt>updateRef</tt> function if it can get a value (the
--   value returned by <tt>getRef</tt> is not the lifted form of
--   <a>Nothing</a>).
type Partial s t a b = forall w r. (Functor w, Applicative w, Monad w, Functor r, Applicative r, MonadPlus r, Morph Maybe r) => Reference w r MU MU s t a b

-- | A reference that can access data that is available in a number of
--   instances inside the contexts.
--   
--   Any reference that is a <a>Traversal</a> should perform the action
--   given to its updater in the exactly the same number of times that is
--   the number of the values returned by it's <tt>getRef</tt> function.
type Traversal s t a b = forall w r. (RefMonads w r, MonadPlus r, Morph Maybe r, Morph [] r) => Reference w r MU MU s t a b
type IOMonads w r = (Morph IO w, Morph IO r, MorphControl IO w, MorphControl IO r)

-- | A reference that can access mutable data.
type IOLens s t a b = forall w r. (RefMonads w r, IOMonads w r) => Reference w r MU MU s t a b

-- | A reference that can access mutable data that may not exist in the
--   context.
type IOPartial s t a b = forall w r. (RefMonads w r, IOMonads w r, MonadPlus r, Morph Maybe r) => Reference w r MU MU s t a b
type IOTraversal s t a b = forall w r. (RefMonads w r, IOMonads w r, MonadPlus r, Morph Maybe r, Morph [] r) => Reference w r MU MU s t a b

-- | A reference that can access a value inside a <a>StateT</a> transformed
--   monad.
type StateLens st m s t a b = forall w r. (RefMonads w r, Morph (StateT st m) w, Morph (StateT st m) r) => Reference w r MU MU s t a b

-- | A reference that can access a value inside a <a>StateT</a> transformed
--   monad that may not exist.
type StatePartial st m s t a b = forall w r. (RefMonads w r, Morph (StateT st m) w, MonadPlus r, Morph Maybe r, Morph (StateT st m) r) => Reference w r MU MU s t a b

-- | A reference that can access a value inside a <a>StateT</a> transformed
--   monad that may exist in multiple instances.
type StateTraversal st m s t a b = forall w r. (RefMonads w r, Morph (StateT st m) w, MonadPlus r, Morph Maybe r, Morph [] r, Morph (StateT st m) r) => Reference w r MU MU s t a b

-- | A reference that can access a value inside a <a>WriterT</a>
--   transformed monad.
type WriterLens st m s t a b = forall w r. (RefMonads w r, Morph (WriterT st m) w, Morph (WriterT st m) r) => Reference w r MU MU s t a b

-- | A reference that can access a value inside a <a>WriterT</a>
--   transformed monad that may not exist.
type WriterPartial st m s t a b = forall w r. (RefMonads w r, Morph (WriterT st m) w, MonadPlus r, Morph Maybe r, Morph (WriterT st m) r) => Reference w r MU MU s t a b

-- | A reference that can access a value inside a <tt>WriteT</tt>
--   transformed monad that may exist in multiple instances.
type WriterTraversal st m s t a b = forall w r. (RefMonads w r, Morph (WriterT st m) w, MonadPlus r, Morph Maybe r, Morph [] r, Morph (WriterT st m) r) => Reference w r MU MU s t a b

-- | A reference that can access a value inside an <a>ST</a> transformed
--   monad.
type STLens st s t a b = forall w r. (RefMonads w r, Morph (ST st) w, Morph (ST st) r) => Reference w r MU MU s t a b

-- | A reference that can access a value inside an <a>ST</a> transformed
--   monad that may not exist.
type STPartial st s t a b = forall w r. (RefMonads w r, Morph (ST st) w, MonadPlus r, Morph Maybe r, Morph (ST st) r) => Reference w r MU MU s t a b

-- | A reference that can access a value inside an <a>ST</a> transformed
--   monad that may exist in multiple instances.
type STTraversal st s t a b = forall w r. (RefMonads w r, Morph (ST st) w, MonadPlus r, Morph Maybe r, Morph [] r, Morph (ST st) r) => Reference w r MU MU s t a b

-- | A class for representing calculation in a simpler monad.
--   
--   <pre>
--   pullBack . sink === id
--   </pre>
class MorphControl (m1 :: * -> *) (m2 :: * -> *) where {
    data family MSt m1 m2 a :: *;
}
sink :: MorphControl m1 m2 => m2 a -> m1 (MSt m1 m2 a)
pullBack :: MorphControl m1 m2 => m1 (MSt m1 m2 a) -> m2 a
instance GHC.Base.Monad m => Control.Reference.Types.MorphControl m (Control.Monad.Trans.Maybe.MaybeT m)
instance GHC.Base.Monad m => Control.Reference.Types.MorphControl m (Control.Monad.Trans.List.ListT m)
instance Control.Reference.Types.MorphControl GHC.Types.IO GHC.Types.IO
instance GHC.Base.Monad m => Control.Reference.Types.MorphControl m Control.Reference.Representation.MU


-- | Common operators for using references.
--   
--   There are four kinds of operator for every type of reference. The
--   operators are either getters (<a>^.</a> and <a>^?</a>), setters
--   (<a>.=</a> and <a>!=</a>), monadic updaters (<a>.~</a> and <a>!~</a>),
--   pure updaters (<a>.-</a> and <a>!-</a>) or action performers
--   (<a>!|</a>).
--   
--   The former operators (with the dot) are pure operators, the later are
--   monadic operators. For example, <tt>(1,2) ^. _1</tt> results in a pure
--   numeric value, while <tt>Right 4 ^? right</tt> produces <tt>Just
--   4</tt> (or a higher level value representing <tt>Just 4</tt>).
module Control.Reference.Operators

-- | Pure getter operator
(^.) :: s -> Getter Identity s t a b -> a
infixl 4 ^.

-- | Generic getter operator
(^?) :: Monad m => s -> Getter m s t a b -> m a
infixl 4 ^?

-- | Gets the context from the referenced element by turning the reference.
review :: Reference MU MU MU Identity s s a a -> a -> s

-- | Pure setter function
(.=) :: Setter Identity s t a b -> b -> s -> t
infixl 4 .=

-- | Monadic setter function
(!=) :: Setter m s t a b -> b -> s -> m t
infixl 4 !=

-- | Monadic updater with a pure result
(.~) :: Setter Identity s t a b -> (a -> Identity b) -> s -> t
infixl 4 .~

-- | Monadic updater
(!~) :: Setter m s t a b -> (a -> m b) -> s -> m t
infixl 4 !~

-- | Pure updater with pure function
(.-) :: Setter Identity s t a b -> (a -> b) -> s -> t
infixl 4 .-

-- | Monadic update with pure function
(!-) :: Monad m => Setter m s t a b -> (a -> b) -> s -> m t
infixl 4 !-

-- | Perform a given action monadically
(!|) :: Monad m => Setter m s s a a -> (a -> m c) -> s -> m s
infixl 4 !|


-- | Functions to create references from simple functions and members of
--   the lens library.
module Control.Reference.Generators

-- | Generates a traversal for any <a>Traversable</a> <a>Functor</a>
traversal :: Traversable t => Traversal (t a) (t b) a b

-- | Generate a lens from a pair of inverse functions
iso :: (a -> b) -> (b -> a) -> Simple Iso a b
iso' :: (a -> b) -> (a' -> b') -> (b -> a) -> (b' -> a') -> Iso a a' b b'

-- | Generates a lens from a getter and a setter
lens :: (s -> a) -> (b -> s -> t) -> Lens s t a b

-- | Creates a polymorphic partial lense
--   
--   <tt>Either t a</tt> is used instead of <tt>Maybe a</tt> to permit the
--   types of <tt>s</tt> and <tt>t</tt> to differ.
partial :: (s -> Either t (a, b -> t)) -> Partial s t a b

-- | Creates a polymorphic partial lens that can be turned to give a total
--   lens
prism :: (a -> s) -> (b -> t) -> (s -> Either t a) -> (t -> Maybe b) -> Prism s t a b

-- | Creates a monomorphic partial lens that can be turned to give a total
--   lens
simplePrism :: (a -> s) -> (s -> Maybe a) -> Prism s s a a

-- | Creates a simple partial lens
simplePartial :: (s -> Maybe (a, a -> s)) -> Partial s s a a

-- | Clones a lens from <a>Control.Lens</a>
fromLens :: (forall f. Functor f => (a -> f b) -> s -> f t) -> Lens s t a b

-- | Clones a traversal from <a>Control.Lens</a>
fromTraversal :: (forall f. Applicative f => (a -> f b) -> s -> f t) -> Traversal s t a b

-- | References all the elements accessed by uniplate
uniplateRef :: Uniplate a => Simple Traversal a a

-- | References all the elements accessed by biplate
biplateRef :: Biplate a b => Simple Traversal a b

-- | Filters the traversed elements with a given predicate. Has specific
--   versions for traversals and partial lenses.
filtered :: (a -> Bool) -> Simple RefPlus a a


-- | References for standard containers
module Control.Reference.Predefined.Containers

-- | Lenses for given values in a data structure that is indexed by keys.
class Association e where {
    type family AssocIndex e :: *;
    type family AssocElem e :: *;
}
element :: Association e => AssocIndex e -> Simple Partial e (AssocElem e)
class Association e => Mapping e
at :: Mapping e => AssocIndex e -> Simple Lens e (Maybe (AssocElem e))

-- | Containers that can be used as a set, inserting and removing elements
class SetLike e where {
    type family SetElem e :: *;
}
contains :: SetLike e => SetElem e -> Simple Lens e Bool
instance GHC.Classes.Ord v => Control.Reference.Predefined.Containers.SetLike (Data.Set.Internal.Set v)
instance Control.Reference.Predefined.Containers.SetLike Data.IntSet.Internal.IntSet
instance GHC.Classes.Eq a => Control.Reference.Predefined.Containers.Mapping (a -> GHC.Maybe.Maybe b)
instance GHC.Classes.Ord k => Control.Reference.Predefined.Containers.Mapping (Data.Map.Internal.Map k v)
instance Control.Reference.Predefined.Containers.Mapping (Data.IntMap.Internal.IntMap v)
instance Control.Reference.Predefined.Containers.Association [a]
instance GHC.Arr.Ix i => Control.Reference.Predefined.Containers.Association (GHC.Arr.Array i a)
instance Control.Reference.Predefined.Containers.Association (Data.Sequence.Internal.Seq a)
instance Control.Reference.Predefined.Containers.Association Data.Text.Internal.Text
instance GHC.Classes.Eq a => Control.Reference.Predefined.Containers.Association (a -> GHC.Maybe.Maybe b)
instance GHC.Classes.Ord k => Control.Reference.Predefined.Containers.Association (Data.Map.Internal.Map k v)
instance Control.Reference.Predefined.Containers.Association (Data.IntMap.Internal.IntMap v)


-- | Predefined references for commonly used data structures and reference
--   generators.
--   
--   When defining lenses one should use the more general types. For
--   instance <a>Lens</a> instead of the more strict <tt>Lens'</tt>. This
--   way references with different <tt>m1</tt> and <tt>m2</tt> monads can
--   be combined if there is a monad <tt>m'</tt> for <tt>MMorph m1 m'</tt>
--   and <tt>MMorph m2 m'</tt>.
module Control.Reference.Predefined

-- | An identical lens. Accesses the context.
--   
--   <pre>
--   self &amp; a = a &amp; self = a
--   </pre>
self :: Lens a b a b

-- | An empty reference that do not traverse anything
--   
--   <pre>
--   emptyRef &amp;+&amp; a = a &amp;+&amp; emptyRef = a
--   </pre>
--   
--   <pre>
--   a &amp; emptyRef = emptyRef &amp; a = emptyRef
--   </pre>
emptyRef :: Simple RefPlus s a

-- | An indexed lens for accessing points a function
atArg :: Eq a => a -> Simple Lens (a -> b) b

-- | A partial lens to access the value that may not exist
just :: Prism (Maybe a) (Maybe b) a b

-- | A partial lens to access the right option of an <a>Either</a>
right :: Prism (Either a b) (Either a c) b c

-- | A partial lens to access the left option of an <a>Either</a>
left :: Prism (Either a c) (Either b c) a b

-- | Access the value that is in the left or right state of an
--   <a>Either</a>
anyway :: Lens (Either a a) (Either b b) a b

-- | References both elements of a tuple
both :: Traversal (a, a) (b, b) a b

-- | References the head of a list
atHead :: Simple Lens [a] (Maybe a)

-- | References the element at the head of the list
headElem :: Simple Partial [a] a

-- | References the tail of a list
_tail :: Simple Partial [a] [a]

-- | References a suffix of a list
dropped :: Int -> Simple Partial [a] [a]

-- | Views a list as an optinal pair
view :: Iso [a] [b] (Maybe (a, [a])) (Maybe (b, [b]))

-- | An isomorphism between the list and text representation of a string
text :: Simple Iso String Text

-- | Accesses the reversed version of a list
--   
--   <pre>
--   'turn' reversed == reversed
--   </pre>
reversed :: Iso [a] [b] [a] [b]

-- | Accesses the numerator of a ratio
_numerator :: Integral a => Simple Lens (Ratio a) a

-- | Accesses the denominator of a ratio
_denominator :: Integral a => Simple Lens (Ratio a) a

-- | Accesses the real part of a complex number
_realPart :: RealFloat a => Simple Lens (Complex a) a

-- | Accesses the imaginary part of a complex number
_imagPart :: RealFloat a => Simple Lens (Complex a) a

-- | Accesses the polar representation of a complex number
_polar :: RealFloat a => Simple Lens (Complex a) (a, a)

-- | A dummy object to interact with the user through the console.
data Console
Console :: Console

-- | Interacts with a line of text on the console. Values set are printed,
--   getting is reading from the console.
consoleLine :: Simple IOLens Console String

-- | Reference to the contents of the file. Not thread-safe.
--   
--   An empty file's content is <tt>Just ""</tt> while a non-existent
--   file's is <tt>Nothing</tt>
--   
--   Creates a temporary file to store the result.
fileContent :: Simple IOLens FilePath (Maybe String)

-- | Access a value inside an MVar. Setting is not atomic. If there is two
--   supplier that may set the accessed value, one may block and can
--   corrupt the following updates.
--   
--   Reads and updates are done in sequence, always using consistent data.
mvar :: Simple IOLens (MVar a) a

-- | Generalized version of <a>modifyMVarMasked_</a>.
modifyMVarMasked_ :: (Monad m, Morph IO m, MorphControl IO m) => MVar a -> (a -> m a) -> m ()

-- | Generalized version of <a>mask_</a>.
mask_ :: MorphControl IO m => m a -> m a

-- | Generalized version of <a>onException</a>.
onException :: MorphControl IO m => m a -> m b -> m a
chan :: Simple IOLens (Chan a) a

-- | Access the value of an IORef.
ioref :: Simple IOLens (IORef a) a

-- | Access the state inside a state monad (from any context).
state :: forall s m a. Monad m => Simple (StateLens s m) a s

-- | Access the value inside an <a>STRef</a>
stRef :: Simple (STLens s) (STRef s a) a

-- | Filters an indexed reference based on the index
whereOf :: (RefMonads w r, MonadPlus r) => (i -> Bool) -> IndexedReference i w r MU MU s s a a -> IndexedReference i w r MU MU s s a a


-- | An interface with references that can be used internally while
--   generating instances for <tt>MMorph</tt> and tuple lens classes.
--   
--   Only the public parts of <a>Control.Reference.Representation</a> are
--   exported.
--   
--   For creating a new interface with different generated elements, use
--   this internal interface.
module Control.Reference.InternalInterface
bireference :: (RefMonads w r, RefMonads w' r') => (s -> r a) -> (b -> s -> w t) -> ((a -> w b) -> s -> w t) -> (a -> r' s) -> (t -> a -> w' b) -> ((s -> w' t) -> a -> w' b) -> Reference w r w' r' s t a b

-- | Creates a reference.
reference :: RefMonads w r => (s -> r a) -> (b -> s -> w t) -> ((a -> w b) -> s -> w t) -> Reference w r MU MU s t a b

-- | Creates a reference with explicit close operations that are executed
--   after the data is accessed.
referenceWithClose :: RefMonads w r => (s -> r a) -> (s -> r ()) -> (b -> s -> w t) -> (s -> w ()) -> ((a -> w b) -> s -> w t) -> (s -> w ()) -> Reference w r MU MU s t a b


-- | A module for creating lenses to fields of simple, tuple data
--   structures like pairs, triplets, and so on.
module Control.Reference.TH.Tuple

-- | A tuple configuration is a scheme for tuple-like data structures.
data TupleConf
TupleConf :: ([Name] -> Type) -> ([Name] -> Pat) -> ([Name] -> Exp) -> TupleConf
[tupleType] :: TupleConf -> [Name] -> Type
[tuplePattern] :: TupleConf -> [Name] -> Pat
[tupleExpr] :: TupleConf -> [Name] -> Exp

-- | Generates the normal haskell tuples (<tt>(a,b), (a,b,c),
--   (a,b,c,d)</tt>)
hsTupConf :: TupleConf

-- | Creates <tt>Lens_1</tt> ... <tt>Lens_n</tt> classes, and instances for
--   tuples up to <tt>m</tt>.
--   
--   Classes and instances look like the following:
--   
--   <pre>
--   class Lens_1 s t a b | s -&gt; a, t -&gt; b
--                        , a t -&gt; s, b s -&gt; t where
--     _1 :: Lens s t a b
--   
--   instance Lens_1 (a,b) (a',b) a a' where
--     _1 = lens ((a,b) -&gt; a) (a' (a,b) -&gt; (a',b))
--   </pre>
makeTupleRefs :: TupleConf -> Int -> Int -> Q [Dec]


-- | A module where tuple classes and instances are created up to 16-tuple
--   using <a>makeTupleRefs</a>. The number of classes and instances can be
--   changed by hiding import from this module and calling
--   <a>makeTupleRefs</a> in an other module.
module Control.Reference.TupleInstances
class Lens_1 s_at6I t_at6J a_at6K b1_at6L | s_at6I -> a_at6K, t_at6J -> b1_at6L, a_at6K t_at6J -> s_at6I, b1_at6L s_at6I -> t_at6J
_1 :: Lens_1 s_at6I t_at6J a_at6K b1_at6L => Lens s_at6I t_at6J a_at6K b1_at6L
class Lens_2 s_at6M t_at6N a_at6O b1_at6P | s_at6M -> a_at6O, t_at6N -> b1_at6P, a_at6O t_at6N -> s_at6M, b1_at6P s_at6M -> t_at6N
_2 :: Lens_2 s_at6M t_at6N a_at6O b1_at6P => Lens s_at6M t_at6N a_at6O b1_at6P
class Lens_3 s_at6Q t_at6R a_at6S b1_at6T | s_at6Q -> a_at6S, t_at6R -> b1_at6T, a_at6S t_at6R -> s_at6Q, b1_at6T s_at6Q -> t_at6R
_3 :: Lens_3 s_at6Q t_at6R a_at6S b1_at6T => Lens s_at6Q t_at6R a_at6S b1_at6T
class Lens_4 s_at6U t_at6V a_at6W b1_at6X | s_at6U -> a_at6W, t_at6V -> b1_at6X, a_at6W t_at6V -> s_at6U, b1_at6X s_at6U -> t_at6V
_4 :: Lens_4 s_at6U t_at6V a_at6W b1_at6X => Lens s_at6U t_at6V a_at6W b1_at6X
class Lens_5 s_at6Y t_at6Z a_at70 b1_at71 | s_at6Y -> a_at70, t_at6Z -> b1_at71, a_at70 t_at6Z -> s_at6Y, b1_at71 s_at6Y -> t_at6Z
_5 :: Lens_5 s_at6Y t_at6Z a_at70 b1_at71 => Lens s_at6Y t_at6Z a_at70 b1_at71
class Lens_6 s_at72 t_at73 a_at74 b1_at75 | s_at72 -> a_at74, t_at73 -> b1_at75, a_at74 t_at73 -> s_at72, b1_at75 s_at72 -> t_at73
_6 :: Lens_6 s_at72 t_at73 a_at74 b1_at75 => Lens s_at72 t_at73 a_at74 b1_at75
class Lens_7 s_at76 t_at77 a_at78 b1_at79 | s_at76 -> a_at78, t_at77 -> b1_at79, a_at78 t_at77 -> s_at76, b1_at79 s_at76 -> t_at77
_7 :: Lens_7 s_at76 t_at77 a_at78 b1_at79 => Lens s_at76 t_at77 a_at78 b1_at79
class Lens_8 s_at7a t_at7b a_at7c b1_at7d | s_at7a -> a_at7c, t_at7b -> b1_at7d, a_at7c t_at7b -> s_at7a, b1_at7d s_at7a -> t_at7b
_8 :: Lens_8 s_at7a t_at7b a_at7c b1_at7d => Lens s_at7a t_at7b a_at7c b1_at7d
class Lens_9 s_at7e t_at7f a_at7g b1_at7h | s_at7e -> a_at7g, t_at7f -> b1_at7h, a_at7g t_at7f -> s_at7e, b1_at7h s_at7e -> t_at7f
_9 :: Lens_9 s_at7e t_at7f a_at7g b1_at7h => Lens s_at7e t_at7f a_at7g b1_at7h
class Lens_10 s_at7i t_at7j a_at7k b1_at7l | s_at7i -> a_at7k, t_at7j -> b1_at7l, a_at7k t_at7j -> s_at7i, b1_at7l s_at7i -> t_at7j
_10 :: Lens_10 s_at7i t_at7j a_at7k b1_at7l => Lens s_at7i t_at7j a_at7k b1_at7l
class Lens_11 s_at7m t_at7n a_at7o b1_at7p | s_at7m -> a_at7o, t_at7n -> b1_at7p, a_at7o t_at7n -> s_at7m, b1_at7p s_at7m -> t_at7n
_11 :: Lens_11 s_at7m t_at7n a_at7o b1_at7p => Lens s_at7m t_at7n a_at7o b1_at7p
class Lens_12 s_at7q t_at7r a_at7s b1_at7t | s_at7q -> a_at7s, t_at7r -> b1_at7t, a_at7s t_at7r -> s_at7q, b1_at7t s_at7q -> t_at7r
_12 :: Lens_12 s_at7q t_at7r a_at7s b1_at7t => Lens s_at7q t_at7r a_at7s b1_at7t
class Lens_13 s_at7u t_at7v a_at7w b1_at7x | s_at7u -> a_at7w, t_at7v -> b1_at7x, a_at7w t_at7v -> s_at7u, b1_at7x s_at7u -> t_at7v
_13 :: Lens_13 s_at7u t_at7v a_at7w b1_at7x => Lens s_at7u t_at7v a_at7w b1_at7x
class Lens_14 s_at7y t_at7z a_at7A b1_at7B | s_at7y -> a_at7A, t_at7z -> b1_at7B, a_at7A t_at7z -> s_at7y, b1_at7B s_at7y -> t_at7z
_14 :: Lens_14 s_at7y t_at7z a_at7A b1_at7B => Lens s_at7y t_at7z a_at7A b1_at7B
class Lens_15 s_at7C t_at7D a_at7E b1_at7F | s_at7C -> a_at7E, t_at7D -> b1_at7F, a_at7E t_at7D -> s_at7C, b1_at7F s_at7C -> t_at7D
_15 :: Lens_15 s_at7C t_at7D a_at7E b1_at7F => Lens s_at7C t_at7D a_at7E b1_at7F
class Lens_16 s_at7G t_at7H a_at7I b1_at7J | s_at7G -> a_at7I, t_at7H -> b1_at7J, a_at7I t_at7H -> s_at7G, b1_at7J s_at7G -> t_at7H
_16 :: Lens_16 s_at7G t_at7H a_at7I b1_at7J => Lens s_at7G t_at7H a_at7I b1_at7J
instance Control.Reference.TupleInstances.Lens_16 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, b2) a16 b2
instance Control.Reference.TupleInstances.Lens_15 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, b2) a15 b2
instance Control.Reference.TupleInstances.Lens_15 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, b2, a16) a15 b2
instance Control.Reference.TupleInstances.Lens_14 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, b2) a14 b2
instance Control.Reference.TupleInstances.Lens_14 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, b2, a15) a14 b2
instance Control.Reference.TupleInstances.Lens_14 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, b2, a15, a16) a14 b2
instance Control.Reference.TupleInstances.Lens_13 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, b2) a13 b2
instance Control.Reference.TupleInstances.Lens_13 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, b2, a14) a13 b2
instance Control.Reference.TupleInstances.Lens_13 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, b2, a14, a15) a13 b2
instance Control.Reference.TupleInstances.Lens_13 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, b2, a14, a15, a16) a13 b2
instance Control.Reference.TupleInstances.Lens_12 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, b2) a12 b2
instance Control.Reference.TupleInstances.Lens_12 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, b2, a13) a12 b2
instance Control.Reference.TupleInstances.Lens_12 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, b2, a13, a14) a12 b2
instance Control.Reference.TupleInstances.Lens_12 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, b2, a13, a14, a15) a12 b2
instance Control.Reference.TupleInstances.Lens_12 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, b2, a13, a14, a15, a16) a12 b2
instance Control.Reference.TupleInstances.Lens_11 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, b2) a11 b2
instance Control.Reference.TupleInstances.Lens_11 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, b2, a12) a11 b2
instance Control.Reference.TupleInstances.Lens_11 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, b2, a12, a13) a11 b2
instance Control.Reference.TupleInstances.Lens_11 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, b2, a12, a13, a14) a11 b2
instance Control.Reference.TupleInstances.Lens_11 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, b2, a12, a13, a14, a15) a11 b2
instance Control.Reference.TupleInstances.Lens_11 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, b2, a12, a13, a14, a15, a16) a11 b2
instance Control.Reference.TupleInstances.Lens_10 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) (a1, a2, a3, a4, a5, a6, a7, a8, a9, b2) a10 b2
instance Control.Reference.TupleInstances.Lens_10 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) (a1, a2, a3, a4, a5, a6, a7, a8, a9, b2, a11) a10 b2
instance Control.Reference.TupleInstances.Lens_10 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) (a1, a2, a3, a4, a5, a6, a7, a8, a9, b2, a11, a12) a10 b2
instance Control.Reference.TupleInstances.Lens_10 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) (a1, a2, a3, a4, a5, a6, a7, a8, a9, b2, a11, a12, a13) a10 b2
instance Control.Reference.TupleInstances.Lens_10 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) (a1, a2, a3, a4, a5, a6, a7, a8, a9, b2, a11, a12, a13, a14) a10 b2
instance Control.Reference.TupleInstances.Lens_10 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) (a1, a2, a3, a4, a5, a6, a7, a8, a9, b2, a11, a12, a13, a14, a15) a10 b2
instance Control.Reference.TupleInstances.Lens_10 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) (a1, a2, a3, a4, a5, a6, a7, a8, a9, b2, a11, a12, a13, a14, a15, a16) a10 b2
instance Control.Reference.TupleInstances.Lens_9 (a1, a2, a3, a4, a5, a6, a7, a8, a9) (a1, a2, a3, a4, a5, a6, a7, a8, b2) a9 b2
instance Control.Reference.TupleInstances.Lens_9 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) (a1, a2, a3, a4, a5, a6, a7, a8, b2, a10) a9 b2
instance Control.Reference.TupleInstances.Lens_9 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) (a1, a2, a3, a4, a5, a6, a7, a8, b2, a10, a11) a9 b2
instance Control.Reference.TupleInstances.Lens_9 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) (a1, a2, a3, a4, a5, a6, a7, a8, b2, a10, a11, a12) a9 b2
instance Control.Reference.TupleInstances.Lens_9 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) (a1, a2, a3, a4, a5, a6, a7, a8, b2, a10, a11, a12, a13) a9 b2
instance Control.Reference.TupleInstances.Lens_9 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) (a1, a2, a3, a4, a5, a6, a7, a8, b2, a10, a11, a12, a13, a14) a9 b2
instance Control.Reference.TupleInstances.Lens_9 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) (a1, a2, a3, a4, a5, a6, a7, a8, b2, a10, a11, a12, a13, a14, a15) a9 b2
instance Control.Reference.TupleInstances.Lens_9 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) (a1, a2, a3, a4, a5, a6, a7, a8, b2, a10, a11, a12, a13, a14, a15, a16) a9 b2
instance Control.Reference.TupleInstances.Lens_8 (a1, a2, a3, a4, a5, a6, a7, a8) (a1, a2, a3, a4, a5, a6, a7, b2) a8 b2
instance Control.Reference.TupleInstances.Lens_8 (a1, a2, a3, a4, a5, a6, a7, a8, a9) (a1, a2, a3, a4, a5, a6, a7, b2, a9) a8 b2
instance Control.Reference.TupleInstances.Lens_8 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) (a1, a2, a3, a4, a5, a6, a7, b2, a9, a10) a8 b2
instance Control.Reference.TupleInstances.Lens_8 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) (a1, a2, a3, a4, a5, a6, a7, b2, a9, a10, a11) a8 b2
instance Control.Reference.TupleInstances.Lens_8 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) (a1, a2, a3, a4, a5, a6, a7, b2, a9, a10, a11, a12) a8 b2
instance Control.Reference.TupleInstances.Lens_8 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) (a1, a2, a3, a4, a5, a6, a7, b2, a9, a10, a11, a12, a13) a8 b2
instance Control.Reference.TupleInstances.Lens_8 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) (a1, a2, a3, a4, a5, a6, a7, b2, a9, a10, a11, a12, a13, a14) a8 b2
instance Control.Reference.TupleInstances.Lens_8 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) (a1, a2, a3, a4, a5, a6, a7, b2, a9, a10, a11, a12, a13, a14, a15) a8 b2
instance Control.Reference.TupleInstances.Lens_8 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) (a1, a2, a3, a4, a5, a6, a7, b2, a9, a10, a11, a12, a13, a14, a15, a16) a8 b2
instance Control.Reference.TupleInstances.Lens_7 (a1, a2, a3, a4, a5, a6, a7) (a1, a2, a3, a4, a5, a6, b2) a7 b2
instance Control.Reference.TupleInstances.Lens_7 (a1, a2, a3, a4, a5, a6, a7, a8) (a1, a2, a3, a4, a5, a6, b2, a8) a7 b2
instance Control.Reference.TupleInstances.Lens_7 (a1, a2, a3, a4, a5, a6, a7, a8, a9) (a1, a2, a3, a4, a5, a6, b2, a8, a9) a7 b2
instance Control.Reference.TupleInstances.Lens_7 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) (a1, a2, a3, a4, a5, a6, b2, a8, a9, a10) a7 b2
instance Control.Reference.TupleInstances.Lens_7 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) (a1, a2, a3, a4, a5, a6, b2, a8, a9, a10, a11) a7 b2
instance Control.Reference.TupleInstances.Lens_7 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) (a1, a2, a3, a4, a5, a6, b2, a8, a9, a10, a11, a12) a7 b2
instance Control.Reference.TupleInstances.Lens_7 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) (a1, a2, a3, a4, a5, a6, b2, a8, a9, a10, a11, a12, a13) a7 b2
instance Control.Reference.TupleInstances.Lens_7 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) (a1, a2, a3, a4, a5, a6, b2, a8, a9, a10, a11, a12, a13, a14) a7 b2
instance Control.Reference.TupleInstances.Lens_7 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) (a1, a2, a3, a4, a5, a6, b2, a8, a9, a10, a11, a12, a13, a14, a15) a7 b2
instance Control.Reference.TupleInstances.Lens_7 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) (a1, a2, a3, a4, a5, a6, b2, a8, a9, a10, a11, a12, a13, a14, a15, a16) a7 b2
instance Control.Reference.TupleInstances.Lens_6 (a1, a2, a3, a4, a5, a6) (a1, a2, a3, a4, a5, b2) a6 b2
instance Control.Reference.TupleInstances.Lens_6 (a1, a2, a3, a4, a5, a6, a7) (a1, a2, a3, a4, a5, b2, a7) a6 b2
instance Control.Reference.TupleInstances.Lens_6 (a1, a2, a3, a4, a5, a6, a7, a8) (a1, a2, a3, a4, a5, b2, a7, a8) a6 b2
instance Control.Reference.TupleInstances.Lens_6 (a1, a2, a3, a4, a5, a6, a7, a8, a9) (a1, a2, a3, a4, a5, b2, a7, a8, a9) a6 b2
instance Control.Reference.TupleInstances.Lens_6 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) (a1, a2, a3, a4, a5, b2, a7, a8, a9, a10) a6 b2
instance Control.Reference.TupleInstances.Lens_6 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) (a1, a2, a3, a4, a5, b2, a7, a8, a9, a10, a11) a6 b2
instance Control.Reference.TupleInstances.Lens_6 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) (a1, a2, a3, a4, a5, b2, a7, a8, a9, a10, a11, a12) a6 b2
instance Control.Reference.TupleInstances.Lens_6 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) (a1, a2, a3, a4, a5, b2, a7, a8, a9, a10, a11, a12, a13) a6 b2
instance Control.Reference.TupleInstances.Lens_6 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) (a1, a2, a3, a4, a5, b2, a7, a8, a9, a10, a11, a12, a13, a14) a6 b2
instance Control.Reference.TupleInstances.Lens_6 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) (a1, a2, a3, a4, a5, b2, a7, a8, a9, a10, a11, a12, a13, a14, a15) a6 b2
instance Control.Reference.TupleInstances.Lens_6 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) (a1, a2, a3, a4, a5, b2, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) a6 b2
instance Control.Reference.TupleInstances.Lens_5 (a1, a2, a3, a4, a5) (a1, a2, a3, a4, b2) a5 b2
instance Control.Reference.TupleInstances.Lens_5 (a1, a2, a3, a4, a5, a6) (a1, a2, a3, a4, b2, a6) a5 b2
instance Control.Reference.TupleInstances.Lens_5 (a1, a2, a3, a4, a5, a6, a7) (a1, a2, a3, a4, b2, a6, a7) a5 b2
instance Control.Reference.TupleInstances.Lens_5 (a1, a2, a3, a4, a5, a6, a7, a8) (a1, a2, a3, a4, b2, a6, a7, a8) a5 b2
instance Control.Reference.TupleInstances.Lens_5 (a1, a2, a3, a4, a5, a6, a7, a8, a9) (a1, a2, a3, a4, b2, a6, a7, a8, a9) a5 b2
instance Control.Reference.TupleInstances.Lens_5 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) (a1, a2, a3, a4, b2, a6, a7, a8, a9, a10) a5 b2
instance Control.Reference.TupleInstances.Lens_5 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) (a1, a2, a3, a4, b2, a6, a7, a8, a9, a10, a11) a5 b2
instance Control.Reference.TupleInstances.Lens_5 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) (a1, a2, a3, a4, b2, a6, a7, a8, a9, a10, a11, a12) a5 b2
instance Control.Reference.TupleInstances.Lens_5 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) (a1, a2, a3, a4, b2, a6, a7, a8, a9, a10, a11, a12, a13) a5 b2
instance Control.Reference.TupleInstances.Lens_5 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) (a1, a2, a3, a4, b2, a6, a7, a8, a9, a10, a11, a12, a13, a14) a5 b2
instance Control.Reference.TupleInstances.Lens_5 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) (a1, a2, a3, a4, b2, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) a5 b2
instance Control.Reference.TupleInstances.Lens_5 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) (a1, a2, a3, a4, b2, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) a5 b2
instance Control.Reference.TupleInstances.Lens_4 (a1, a2, a3, a4) (a1, a2, a3, b2) a4 b2
instance Control.Reference.TupleInstances.Lens_4 (a1, a2, a3, a4, a5) (a1, a2, a3, b2, a5) a4 b2
instance Control.Reference.TupleInstances.Lens_4 (a1, a2, a3, a4, a5, a6) (a1, a2, a3, b2, a5, a6) a4 b2
instance Control.Reference.TupleInstances.Lens_4 (a1, a2, a3, a4, a5, a6, a7) (a1, a2, a3, b2, a5, a6, a7) a4 b2
instance Control.Reference.TupleInstances.Lens_4 (a1, a2, a3, a4, a5, a6, a7, a8) (a1, a2, a3, b2, a5, a6, a7, a8) a4 b2
instance Control.Reference.TupleInstances.Lens_4 (a1, a2, a3, a4, a5, a6, a7, a8, a9) (a1, a2, a3, b2, a5, a6, a7, a8, a9) a4 b2
instance Control.Reference.TupleInstances.Lens_4 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) (a1, a2, a3, b2, a5, a6, a7, a8, a9, a10) a4 b2
instance Control.Reference.TupleInstances.Lens_4 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) (a1, a2, a3, b2, a5, a6, a7, a8, a9, a10, a11) a4 b2
instance Control.Reference.TupleInstances.Lens_4 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) (a1, a2, a3, b2, a5, a6, a7, a8, a9, a10, a11, a12) a4 b2
instance Control.Reference.TupleInstances.Lens_4 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) (a1, a2, a3, b2, a5, a6, a7, a8, a9, a10, a11, a12, a13) a4 b2
instance Control.Reference.TupleInstances.Lens_4 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) (a1, a2, a3, b2, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) a4 b2
instance Control.Reference.TupleInstances.Lens_4 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) (a1, a2, a3, b2, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) a4 b2
instance Control.Reference.TupleInstances.Lens_4 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) (a1, a2, a3, b2, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) a4 b2
instance Control.Reference.TupleInstances.Lens_3 (a1, a2, a3) (a1, a2, b2) a3 b2
instance Control.Reference.TupleInstances.Lens_3 (a1, a2, a3, a4) (a1, a2, b2, a4) a3 b2
instance Control.Reference.TupleInstances.Lens_3 (a1, a2, a3, a4, a5) (a1, a2, b2, a4, a5) a3 b2
instance Control.Reference.TupleInstances.Lens_3 (a1, a2, a3, a4, a5, a6) (a1, a2, b2, a4, a5, a6) a3 b2
instance Control.Reference.TupleInstances.Lens_3 (a1, a2, a3, a4, a5, a6, a7) (a1, a2, b2, a4, a5, a6, a7) a3 b2
instance Control.Reference.TupleInstances.Lens_3 (a1, a2, a3, a4, a5, a6, a7, a8) (a1, a2, b2, a4, a5, a6, a7, a8) a3 b2
instance Control.Reference.TupleInstances.Lens_3 (a1, a2, a3, a4, a5, a6, a7, a8, a9) (a1, a2, b2, a4, a5, a6, a7, a8, a9) a3 b2
instance Control.Reference.TupleInstances.Lens_3 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) (a1, a2, b2, a4, a5, a6, a7, a8, a9, a10) a3 b2
instance Control.Reference.TupleInstances.Lens_3 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) (a1, a2, b2, a4, a5, a6, a7, a8, a9, a10, a11) a3 b2
instance Control.Reference.TupleInstances.Lens_3 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) (a1, a2, b2, a4, a5, a6, a7, a8, a9, a10, a11, a12) a3 b2
instance Control.Reference.TupleInstances.Lens_3 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) (a1, a2, b2, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) a3 b2
instance Control.Reference.TupleInstances.Lens_3 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) (a1, a2, b2, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) a3 b2
instance Control.Reference.TupleInstances.Lens_3 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) (a1, a2, b2, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) a3 b2
instance Control.Reference.TupleInstances.Lens_3 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) (a1, a2, b2, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) a3 b2
instance Control.Reference.TupleInstances.Lens_2 (a1, a2) (a1, b2) a2 b2
instance Control.Reference.TupleInstances.Lens_2 (a1, a2, a3) (a1, b2, a3) a2 b2
instance Control.Reference.TupleInstances.Lens_2 (a1, a2, a3, a4) (a1, b2, a3, a4) a2 b2
instance Control.Reference.TupleInstances.Lens_2 (a1, a2, a3, a4, a5) (a1, b2, a3, a4, a5) a2 b2
instance Control.Reference.TupleInstances.Lens_2 (a1, a2, a3, a4, a5, a6) (a1, b2, a3, a4, a5, a6) a2 b2
instance Control.Reference.TupleInstances.Lens_2 (a1, a2, a3, a4, a5, a6, a7) (a1, b2, a3, a4, a5, a6, a7) a2 b2
instance Control.Reference.TupleInstances.Lens_2 (a1, a2, a3, a4, a5, a6, a7, a8) (a1, b2, a3, a4, a5, a6, a7, a8) a2 b2
instance Control.Reference.TupleInstances.Lens_2 (a1, a2, a3, a4, a5, a6, a7, a8, a9) (a1, b2, a3, a4, a5, a6, a7, a8, a9) a2 b2
instance Control.Reference.TupleInstances.Lens_2 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) (a1, b2, a3, a4, a5, a6, a7, a8, a9, a10) a2 b2
instance Control.Reference.TupleInstances.Lens_2 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) (a1, b2, a3, a4, a5, a6, a7, a8, a9, a10, a11) a2 b2
instance Control.Reference.TupleInstances.Lens_2 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) (a1, b2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) a2 b2
instance Control.Reference.TupleInstances.Lens_2 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) (a1, b2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) a2 b2
instance Control.Reference.TupleInstances.Lens_2 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) (a1, b2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) a2 b2
instance Control.Reference.TupleInstances.Lens_2 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) (a1, b2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) a2 b2
instance Control.Reference.TupleInstances.Lens_2 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) (a1, b2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) a2 b2
instance Control.Reference.TupleInstances.Lens_1 (a1, a2) (b2, a2) a1 b2
instance Control.Reference.TupleInstances.Lens_1 (a1, a2, a3) (b2, a2, a3) a1 b2
instance Control.Reference.TupleInstances.Lens_1 (a1, a2, a3, a4) (b2, a2, a3, a4) a1 b2
instance Control.Reference.TupleInstances.Lens_1 (a1, a2, a3, a4, a5) (b2, a2, a3, a4, a5) a1 b2
instance Control.Reference.TupleInstances.Lens_1 (a1, a2, a3, a4, a5, a6) (b2, a2, a3, a4, a5, a6) a1 b2
instance Control.Reference.TupleInstances.Lens_1 (a1, a2, a3, a4, a5, a6, a7) (b2, a2, a3, a4, a5, a6, a7) a1 b2
instance Control.Reference.TupleInstances.Lens_1 (a1, a2, a3, a4, a5, a6, a7, a8) (b2, a2, a3, a4, a5, a6, a7, a8) a1 b2
instance Control.Reference.TupleInstances.Lens_1 (a1, a2, a3, a4, a5, a6, a7, a8, a9) (b2, a2, a3, a4, a5, a6, a7, a8, a9) a1 b2
instance Control.Reference.TupleInstances.Lens_1 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) (b2, a2, a3, a4, a5, a6, a7, a8, a9, a10) a1 b2
instance Control.Reference.TupleInstances.Lens_1 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) (b2, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) a1 b2
instance Control.Reference.TupleInstances.Lens_1 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) (b2, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) a1 b2
instance Control.Reference.TupleInstances.Lens_1 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) (b2, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) a1 b2
instance Control.Reference.TupleInstances.Lens_1 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) (b2, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) a1 b2
instance Control.Reference.TupleInstances.Lens_1 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) (b2, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) a1 b2
instance Control.Reference.TupleInstances.Lens_1 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) (b2, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) a1 b2

module Control.Reference.Predefined.Containers.Tree
instance Control.Reference.Predefined.Containers.Association (Data.Tree.Tree v)


-- | An example module that adds references for Template Haskell. These
--   references are used to create the TH functions that generate
--   references.
module Control.Reference.Examples.TH

-- | Reference all type variables inside a type
typeVariableNames :: Simple Traversal Type Name

-- | Reference the name of the type variable
typeVar :: Simple Partial Type Name

-- | Reference all type variables inside a type
typeVariables :: Simple Traversal Type Type

-- | Reference all type variables not binded by a forall
freeTypeVariables :: Simple Traversal Type Type

-- | Reference the name of the type variable inside a type variable binder
typeVarName :: Simple Lens TyVarBndr Name

-- | Reference the characters of the name. If changed there is no guarantee
--   that the created name will be unique.
nameBaseStr :: Simple Lens Name String

-- | Reference the record fields in a constructor.
recFields :: Simple Partial Con [(Name, Strict, Type)]

-- | Reference all fields (data members) in a constructor.
conFields :: Simple Lens Con [(Strict, Type)]

-- | Reference types of fields
conTypes :: Simple Traversal Con Type

-- | Reference the name of the constructor
conName :: Simple Lens Con Name

-- | Access a function application as a list of expressions with the
--   function application at the head of the list and the arguments on it's
--   tail.
funApplication :: Simple Iso Exp [Exp]

-- | Accesses the name of the defined object. Does not return name in
--   signatures.
definedName :: Simple Partial Dec Name

-- | Accesses the constructors of a data or newtype definition. After
--   changing the definition becames a newtype if there is only one
--   constructor.
definedConstructors :: Simple Partial Dec [Con]

-- | Accesses the type variables of a definition
definedTypeArgs :: Simple Partial Dec [TyVarBndr]


-- | This module can be used to generate references for record fields. If
--   the field surely exists, a <a>Lens</a> will be generated. If the field
--   may not exist, it will be a <a>Partial</a> lens.
--   
--   It will have the maximum amount of polymorphism it can create.
--   
--   If the name of the field starts with "_", the name of the field will
--   be the same with "_" removed. If not, the reference name will be the
--   field name with "_" added te the start.
--   
--   The following code sample:
--   
--   <pre>
--   data Maybe' a = Just' { _fromJust' :: a }
--                 | Nothing'
--   $(makeReferences ''Maybe)
--   
--   data Tuple a b = Tuple { _fst' :: a, _snd' :: b }
--   $(makeReferences ''Tuple)
--   </pre>
--   
--   Is equivalent to:
--   
--   <pre>
--   data Maybe' a = Just' { _fromJust' :: a }
--                 | Nothing'
--   
--   fromJust' :: <a>Partial</a> (Maybe' a) (Maybe' b) a b
--   fromJust' = <a>partial</a> (case Just' x -&gt; Right (x, y -&gt; return (Just' y))
--                              Nothing' -&gt; Left (return Nothing'))
--   
--   data Tuple a b = Tuple { _fst' :: a, _snd' :: b }
--   fst' :: <a>Lens</a> (Tuple a c) (Tuple b c) a b
--   fst' = <a>lens</a> _fst' (b tup -&gt; tup { _fst' = b })
--   snd' :: <a>Lens</a> (Tuple a c) (Tuple a d) c d
--   snd' = <a>lens</a> _snd' (b tup -&gt; tup { _snd' = b })
--   </pre>
module Control.Reference.TH.Records

-- | Creates references for fields of a data structure.
makeReferences :: Name -> Q [Dec]

-- | Shows the generated declarations instead of using them.
debugTH :: Q [Dec] -> Q [Dec]


-- | A frontend module for the Control.Reference package
module Control.Reference
