-- 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.Base.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.Base.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_arYC t_arYD a_arYE b1_arYF | s_arYC -> a_arYE, t_arYD -> b1_arYF, a_arYE t_arYD -> s_arYC, b1_arYF s_arYC -> t_arYD
_1 :: Lens_1 s_arYC t_arYD a_arYE b1_arYF => Lens s_arYC t_arYD a_arYE b1_arYF
class Lens_2 s_arYG t_arYH a_arYI b1_arYJ | s_arYG -> a_arYI, t_arYH -> b1_arYJ, a_arYI t_arYH -> s_arYG, b1_arYJ s_arYG -> t_arYH
_2 :: Lens_2 s_arYG t_arYH a_arYI b1_arYJ => Lens s_arYG t_arYH a_arYI b1_arYJ
class Lens_3 s_arYK t_arYL a_arYM b1_arYN | s_arYK -> a_arYM, t_arYL -> b1_arYN, a_arYM t_arYL -> s_arYK, b1_arYN s_arYK -> t_arYL
_3 :: Lens_3 s_arYK t_arYL a_arYM b1_arYN => Lens s_arYK t_arYL a_arYM b1_arYN
class Lens_4 s_arYO t_arYP a_arYQ b1_arYR | s_arYO -> a_arYQ, t_arYP -> b1_arYR, a_arYQ t_arYP -> s_arYO, b1_arYR s_arYO -> t_arYP
_4 :: Lens_4 s_arYO t_arYP a_arYQ b1_arYR => Lens s_arYO t_arYP a_arYQ b1_arYR
class Lens_5 s_arYS t_arYT a_arYU b1_arYV | s_arYS -> a_arYU, t_arYT -> b1_arYV, a_arYU t_arYT -> s_arYS, b1_arYV s_arYS -> t_arYT
_5 :: Lens_5 s_arYS t_arYT a_arYU b1_arYV => Lens s_arYS t_arYT a_arYU b1_arYV
class Lens_6 s_arYW t_arYX a_arYY b1_arYZ | s_arYW -> a_arYY, t_arYX -> b1_arYZ, a_arYY t_arYX -> s_arYW, b1_arYZ s_arYW -> t_arYX
_6 :: Lens_6 s_arYW t_arYX a_arYY b1_arYZ => Lens s_arYW t_arYX a_arYY b1_arYZ
class Lens_7 s_arZ0 t_arZ1 a_arZ2 b1_arZ3 | s_arZ0 -> a_arZ2, t_arZ1 -> b1_arZ3, a_arZ2 t_arZ1 -> s_arZ0, b1_arZ3 s_arZ0 -> t_arZ1
_7 :: Lens_7 s_arZ0 t_arZ1 a_arZ2 b1_arZ3 => Lens s_arZ0 t_arZ1 a_arZ2 b1_arZ3
class Lens_8 s_arZ4 t_arZ5 a_arZ6 b1_arZ7 | s_arZ4 -> a_arZ6, t_arZ5 -> b1_arZ7, a_arZ6 t_arZ5 -> s_arZ4, b1_arZ7 s_arZ4 -> t_arZ5
_8 :: Lens_8 s_arZ4 t_arZ5 a_arZ6 b1_arZ7 => Lens s_arZ4 t_arZ5 a_arZ6 b1_arZ7
class Lens_9 s_arZ8 t_arZ9 a_arZa b1_arZb | s_arZ8 -> a_arZa, t_arZ9 -> b1_arZb, a_arZa t_arZ9 -> s_arZ8, b1_arZb s_arZ8 -> t_arZ9
_9 :: Lens_9 s_arZ8 t_arZ9 a_arZa b1_arZb => Lens s_arZ8 t_arZ9 a_arZa b1_arZb
class Lens_10 s_arZc t_arZd a_arZe b1_arZf | s_arZc -> a_arZe, t_arZd -> b1_arZf, a_arZe t_arZd -> s_arZc, b1_arZf s_arZc -> t_arZd
_10 :: Lens_10 s_arZc t_arZd a_arZe b1_arZf => Lens s_arZc t_arZd a_arZe b1_arZf
class Lens_11 s_arZg t_arZh a_arZi b1_arZj | s_arZg -> a_arZi, t_arZh -> b1_arZj, a_arZi t_arZh -> s_arZg, b1_arZj s_arZg -> t_arZh
_11 :: Lens_11 s_arZg t_arZh a_arZi b1_arZj => Lens s_arZg t_arZh a_arZi b1_arZj
class Lens_12 s_arZk t_arZl a_arZm b1_arZn | s_arZk -> a_arZm, t_arZl -> b1_arZn, a_arZm t_arZl -> s_arZk, b1_arZn s_arZk -> t_arZl
_12 :: Lens_12 s_arZk t_arZl a_arZm b1_arZn => Lens s_arZk t_arZl a_arZm b1_arZn
class Lens_13 s_arZo t_arZp a_arZq b1_arZr | s_arZo -> a_arZq, t_arZp -> b1_arZr, a_arZq t_arZp -> s_arZo, b1_arZr s_arZo -> t_arZp
_13 :: Lens_13 s_arZo t_arZp a_arZq b1_arZr => Lens s_arZo t_arZp a_arZq b1_arZr
class Lens_14 s_arZs t_arZt a_arZu b1_arZv | s_arZs -> a_arZu, t_arZt -> b1_arZv, a_arZu t_arZt -> s_arZs, b1_arZv s_arZs -> t_arZt
_14 :: Lens_14 s_arZs t_arZt a_arZu b1_arZv => Lens s_arZs t_arZt a_arZu b1_arZv
class Lens_15 s_arZw t_arZx a_arZy b1_arZz | s_arZw -> a_arZy, t_arZx -> b1_arZz, a_arZy t_arZx -> s_arZw, b1_arZz s_arZw -> t_arZx
_15 :: Lens_15 s_arZw t_arZx a_arZy b1_arZz => Lens s_arZw t_arZx a_arZy b1_arZz
class Lens_16 s_arZA t_arZB a_arZC b1_arZD | s_arZA -> a_arZC, t_arZB -> b1_arZD, a_arZC t_arZB -> s_arZA, b1_arZD s_arZA -> t_arZB
_16 :: Lens_16 s_arZA t_arZB a_arZC b1_arZD => Lens s_arZA t_arZB a_arZC b1_arZD
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
