-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | safe PostgreSQL queries using Quasiquoters -- -- Before you Post(gres)QL, preql. -- -- preql provides a low-level interface to PostgreSQL and a -- quasiquoter that converts inline variable names to SQL parameters. -- Higher-level interfaces, checking SQL syntax & schema, are -- planned. -- -- the quickstart or the vision -- -- Most applications will want to import the top-level module -- Preql. When writing SQL instances or your own -- higher-level abstractions, you may want the lower-level, IO-specific -- functions in Preql.Wire, not all of which are re-exported -- from Preql. @package preql @version 0.4 -- | Common imports, so I don't need to repeat them everywhere module Preql.Imports -- | Conditional failure of Alternative computations. Defined by -- --
--   guard True  = pure ()
--   guard False = empty
--   
-- --

Examples

-- -- Common uses of guard include conditionally signaling an error -- in an error monad and conditionally rejecting the current choice in an -- Alternative-based parser. -- -- As an example of signaling an error in the error monad Maybe, -- consider a safe division function safeDiv x y that returns -- Nothing when the denominator y is zero and -- Just (x `div` y) otherwise. For example: -- --
--   >>> safeDiv 4 0
--   Nothing
--   >>> safeDiv 4 2
--   Just 2
--   
-- -- A definition of safeDiv using guards, but not guard: -- --
--   safeDiv :: Int -> Int -> Maybe Int
--   safeDiv x y | y /= 0    = Just (x `div` y)
--               | otherwise = Nothing
--   
-- -- A definition of safeDiv using guard and Monad -- do-notation: -- --
--   safeDiv :: Int -> Int -> Maybe Int
--   safeDiv x y = do
--     guard (y /= 0)
--     return (x `div` y)
--   
guard :: Alternative f => Bool -> f () -- | The join function is the conventional monad join operator. It -- is used to remove one level of monadic structure, projecting its bound -- argument into the outer level. -- -- 'join bss' can be understood as the do -- expression -- --
--   do bs <- bss
--      bs
--   
-- --

Examples

-- -- A common use of join is to run an IO computation -- returned from an STM transaction, since STM transactions -- can't perform IO directly. Recall that -- --
--   atomically :: STM a -> IO a
--   
-- -- is used to run STM transactions atomically. So, by specializing -- the types of atomically and join to -- --
--   atomically :: STM (IO b) -> IO (IO b)
--   join       :: IO (IO b)  -> IO b
--   
-- -- we can compose them as -- --
--   join . atomically :: STM (IO b) -> IO b
--   
-- -- to run an STM transaction and the IO action it returns. join :: Monad m => m (m a) -> m a -- | The Monad class defines the basic operations over a -- monad, a concept from a branch of mathematics known as -- category theory. From the perspective of a Haskell programmer, -- however, it is best to think of a monad as an abstract datatype -- of actions. Haskell's do expressions provide a convenient -- syntax for writing monadic expressions. -- -- Instances of Monad should satisfy the following: -- -- -- -- Furthermore, the Monad and Applicative operations should -- relate as follows: -- -- -- -- The above laws imply: -- -- -- -- and that pure and (<*>) satisfy the applicative -- functor laws. -- -- The instances of Monad for lists, Maybe and IO -- defined in the Prelude satisfy these laws. class Applicative m => Monad (m :: Type -> Type) -- | Sequentially compose two actions, passing any value produced by the -- first as an argument to the second. -- -- 'as >>= bs' can be understood as the do -- expression -- --
--   do a <- as
--      bs a
--   
(>>=) :: Monad m => m a -> (a -> m b) -> m b -- | Sequentially compose two actions, discarding any value produced by the -- first, like sequencing operators (such as the semicolon) in imperative -- languages. -- -- 'as >> bs' can be understood as the do -- expression -- --
--   do as
--      bs
--   
(>>) :: Monad m => m a -> m b -> m b -- | Inject a value into the monadic type. return :: Monad m => a -> m a infixl 1 >>= infixl 1 >> -- | A type f is a Functor if it provides a function fmap -- which, given any types a and b lets you apply any -- function from (a -> b) to turn an f a into an -- f b, preserving the structure of f. Furthermore -- f needs to adhere to the following: -- -- -- -- Note, that the second law follows from the free theorem of the type -- fmap and the first law, so you need only check that the former -- condition holds. class Functor (f :: Type -> Type) -- | Using ApplicativeDo: 'fmap f as' can be -- understood as the do expression -- --
--   do a <- as
--      pure (f a)
--   
-- -- with an inferred Functor constraint. fmap :: Functor f => (a -> b) -> f a -> f b -- | Replace all locations in the input with the same value. The default -- definition is fmap . const, but this may be -- overridden with a more efficient version. -- -- Using ApplicativeDo: 'a <$ bs' can be -- understood as the do expression -- --
--   do bs
--      pure a
--   
-- -- with an inferred Functor constraint. (<$) :: Functor f => a -> f b -> f a infixl 4 <$ -- | The class Typeable allows a concrete representation of a type -- to be calculated. class Typeable (a :: k) -- | When a value is bound in do-notation, the pattern on the left -- hand side of <- might not match. In this case, this class -- provides a function to recover. -- -- A Monad without a MonadFail instance may only be used in -- conjunction with pattern that always match, such as newtypes, tuples, -- data types with only a single data constructor, and irrefutable -- patterns (~pat). -- -- Instances of MonadFail should satisfy the following law: -- fail s should be a left zero for >>=, -- --
--   fail s >>= f  =  fail s
--   
-- -- If your Monad is also MonadPlus, a popular definition is -- --
--   fail _ = mzero
--   
class Monad m => MonadFail (m :: Type -> Type) fail :: MonadFail m => String -> m a -- | A functor with application, providing operations to -- -- -- -- A minimal complete definition must include implementations of -- pure and of either <*> or liftA2. If it -- defines both, then they must behave the same as their default -- definitions: -- --
--   (<*>) = liftA2 id
--   
-- --
--   liftA2 f x y = f <$> x <*> y
--   
-- -- Further, any definition must satisfy the following: -- -- -- -- The other methods have the following default definitions, which may be -- overridden with equivalent specialized implementations: -- -- -- -- As a consequence of these laws, the Functor instance for -- f will satisfy -- -- -- -- It may be useful to note that supposing -- --
--   forall x y. p (q x y) = f x . g y
--   
-- -- it follows from the above that -- --
--   liftA2 p (liftA2 q u v) = liftA2 f u . liftA2 g v
--   
-- -- If f is also a Monad, it should satisfy -- -- -- -- (which implies that pure and <*> satisfy the -- applicative functor laws). class Functor f => Applicative (f :: Type -> Type) -- | Lift a value. pure :: Applicative f => a -> f a -- | Sequential application. -- -- A few functors support an implementation of <*> that is -- more efficient than the default one. -- -- Using ApplicativeDo: 'fs <*> as' can be -- understood as the do expression -- --
--   do f <- fs
--      a <- as
--      pure (f a)
--   
(<*>) :: Applicative f => f (a -> b) -> f a -> f b -- | Lift a binary function to actions. -- -- Some functors support an implementation of liftA2 that is more -- efficient than the default one. In particular, if fmap is an -- expensive operation, it is likely better to use liftA2 than to -- fmap over the structure and then use <*>. -- -- This became a typeclass method in 4.10.0.0. Prior to that, it was a -- function defined in terms of <*> and fmap. -- -- Using ApplicativeDo: 'liftA2 f as bs' can be -- understood as the do expression -- --
--   do a <- as
--      b <- bs
--      pure (f a b)
--   
liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c -- | Sequence actions, discarding the value of the first argument. -- -- 'as *> bs' can be understood as the do -- expression -- --
--   do as
--      bs
--   
-- -- This is a tad complicated for our ApplicativeDo extension -- which will give it a Monad constraint. For an -- Applicative constraint we write it of the form -- --
--   do _ <- as
--      b <- bs
--      pure b
--   
(*>) :: Applicative f => f a -> f b -> f b -- | Sequence actions, discarding the value of the second argument. -- -- Using ApplicativeDo: 'as <* bs' can be -- understood as the do expression -- --
--   do a <- as
--      bs
--      pure a
--   
(<*) :: Applicative f => f a -> f b -> f a infixl 4 <* infixl 4 *> infixl 4 <*> -- | Data structures that can be folded. -- -- For example, given a data type -- --
--   data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a)
--   
-- -- a suitable instance would be -- --
--   instance Foldable Tree where
--      foldMap f Empty = mempty
--      foldMap f (Leaf x) = f x
--      foldMap f (Node l k r) = foldMap f l `mappend` f k `mappend` foldMap f r
--   
-- -- This is suitable even for abstract types, as the monoid is assumed to -- satisfy the monoid laws. Alternatively, one could define -- foldr: -- --
--   instance Foldable Tree where
--      foldr f z Empty = z
--      foldr f z (Leaf x) = f x z
--      foldr f z (Node l k r) = foldr f (f k (foldr f z r)) l
--   
-- -- Foldable instances are expected to satisfy the following -- laws: -- --
--   foldr f z t = appEndo (foldMap (Endo . f) t ) z
--   
-- --
--   foldl f z t = appEndo (getDual (foldMap (Dual . Endo . flip f) t)) z
--   
-- --
--   fold = foldMap id
--   
-- --
--   length = getSum . foldMap (Sum . const  1)
--   
-- -- sum, product, maximum, and minimum -- should all be essentially equivalent to foldMap forms, such -- as -- --
--   sum = getSum . foldMap Sum
--   
-- -- but may be less defined. -- -- If the type is also a Functor instance, it should satisfy -- --
--   foldMap f = fold . fmap f
--   
-- -- which implies that -- --
--   foldMap f . fmap g = foldMap (f . g)
--   
class Foldable (t :: Type -> Type) -- | Combine the elements of a structure using a monoid. fold :: (Foldable t, Monoid m) => t m -> m -- | Map each element of the structure to a monoid, and combine the -- results. foldMap :: (Foldable t, Monoid m) => (a -> m) -> t a -> m -- | A variant of foldMap that is strict in the accumulator. foldMap' :: (Foldable t, Monoid m) => (a -> m) -> t a -> m -- | Right-associative fold of a structure. -- -- In the case of lists, foldr, when applied to a binary operator, -- a starting value (typically the right-identity of the operator), and a -- list, reduces the list using the binary operator, from right to left: -- --
--   foldr f z [x1, x2, ..., xn] == x1 `f` (x2 `f` ... (xn `f` z)...)
--   
-- -- Note that, since the head of the resulting expression is produced by -- an application of the operator to the first element of the list, -- foldr can produce a terminating expression from an infinite -- list. -- -- For a general Foldable structure this should be semantically -- identical to, -- --
--   foldr f z = foldr f z . toList
--   
foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b -- | Right-associative fold of a structure, but with strict application of -- the operator. foldr' :: Foldable t => (a -> b -> b) -> b -> t a -> b -- | Left-associative fold of a structure. -- -- In the case of lists, foldl, when applied to a binary operator, -- a starting value (typically the left-identity of the operator), and a -- list, reduces the list using the binary operator, from left to right: -- --
--   foldl f z [x1, x2, ..., xn] == (...((z `f` x1) `f` x2) `f`...) `f` xn
--   
-- -- Note that to produce the outermost application of the operator the -- entire input list must be traversed. This means that foldl' -- will diverge if given an infinite list. -- -- Also note that if you want an efficient left-fold, you probably want -- to use foldl' instead of foldl. The reason for this is -- that latter does not force the "inner" results (e.g. z `f` x1 -- in the above example) before applying them to the operator (e.g. to -- (`f` x2)). This results in a thunk chain <math> -- elements long, which then must be evaluated from the outside-in. -- -- For a general Foldable structure this should be semantically -- identical to, -- --
--   foldl f z = foldl f z . toList
--   
foldl :: Foldable t => (b -> a -> b) -> b -> t a -> b -- | Left-associative fold of a structure but with strict application of -- the operator. -- -- This ensures that each step of the fold is forced to weak head normal -- form before being applied, avoiding the collection of thunks that -- would otherwise occur. This is often what you want to strictly reduce -- a finite list to a single, monolithic result (e.g. length). -- -- For a general Foldable structure this should be semantically -- identical to, -- --
--   foldl' f z = foldl' f z . toList
--   
foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b -- | A variant of foldr that has no base case, and thus may only be -- applied to non-empty structures. -- --
--   foldr1 f = foldr1 f . toList
--   
foldr1 :: Foldable t => (a -> a -> a) -> t a -> a -- | A variant of foldl that has no base case, and thus may only be -- applied to non-empty structures. -- --
--   foldl1 f = foldl1 f . toList
--   
foldl1 :: Foldable t => (a -> a -> a) -> t a -> a -- | List of elements of a structure, from left to right. toList :: Foldable t => t a -> [a] -- | Test whether the structure is empty. The default implementation is -- optimized for structures that are similar to cons-lists, because there -- is no general way to do better. null :: Foldable t => t a -> Bool -- | Returns the size/length of a finite structure as an Int. The -- default implementation is optimized for structures that are similar to -- cons-lists, because there is no general way to do better. length :: Foldable t => t a -> Int -- | Does the element occur in the structure? elem :: (Foldable t, Eq a) => a -> t a -> Bool -- | The largest element of a non-empty structure. maximum :: (Foldable t, Ord a) => t a -> a -- | The least element of a non-empty structure. minimum :: (Foldable t, Ord a) => t a -> a -- | The sum function computes the sum of the numbers of a -- structure. sum :: (Foldable t, Num a) => t a -> a -- | The product function computes the product of the numbers of a -- structure. product :: (Foldable t, Num a) => t a -> a infix 4 `elem` -- | Functors representing data structures that can be traversed from left -- to right. -- -- A definition of traverse must satisfy the following laws: -- -- -- -- A definition of sequenceA must satisfy the following laws: -- -- -- -- where an applicative transformation is a function -- --
--   t :: (Applicative f, Applicative g) => f a -> g a
--   
-- -- preserving the Applicative operations, i.e. -- --
--   t (pure x) = pure x
--   t (f <*> x) = t f <*> t x
--   
-- -- and the identity functor Identity and composition functors -- Compose are from Data.Functor.Identity and -- Data.Functor.Compose. -- -- A result of the naturality law is a purity law for traverse -- --
--   traverse pure = pure
--   
-- -- (The naturality law is implied by parametricity and thus so is the -- purity law [1, p15].) -- -- Instances are similar to Functor, e.g. given a data type -- --
--   data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a)
--   
-- -- a suitable instance would be -- --
--   instance Traversable Tree where
--      traverse f Empty = pure Empty
--      traverse f (Leaf x) = Leaf <$> f x
--      traverse f (Node l k r) = Node <$> traverse f l <*> f k <*> traverse f r
--   
-- -- This is suitable even for abstract types, as the laws for -- <*> imply a form of associativity. -- -- The superclass instances should satisfy the following: -- -- -- -- References: [1] The Essence of the Iterator Pattern, Jeremy Gibbons -- and Bruno C. d. S. Oliveira class (Functor t, Foldable t) => Traversable (t :: Type -> Type) -- | Map each element of a structure to an action, evaluate these actions -- from left to right, and collect the results. For a version that -- ignores the results see traverse_. traverse :: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b) -- | Evaluate each action in the structure from left to right, and collect -- the results. For a version that ignores the results see -- sequenceA_. sequenceA :: (Traversable t, Applicative f) => t (f a) -> f (t a) -- | Map each element of a structure to a monadic action, evaluate these -- actions from left to right, and collect the results. For a version -- that ignores the results see mapM_. mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b) -- | Evaluate each monadic action in the structure from left to right, and -- collect the results. For a version that ignores the results see -- sequence_. sequence :: (Traversable t, Monad m) => t (m a) -> m (t a) data TyCon -- | Promote a function to a monad. liftM :: Monad m => (a1 -> r) -> m a1 -> m r -- | An infix synonym for fmap. -- -- The name of this operator is an allusion to $. Note the -- similarities between their types: -- --
--    ($)  ::              (a -> b) ->   a ->   b
--   (<$>) :: Functor f => (a -> b) -> f a -> f b
--   
-- -- Whereas $ is function application, <$> is function -- application lifted over a Functor. -- --

Examples

-- -- Convert from a Maybe Int to a Maybe -- String using show: -- --
--   >>> show <$> Nothing
--   Nothing
--   
--   >>> show <$> Just 3
--   Just "3"
--   
-- -- Convert from an Either Int Int to an -- Either Int String using show: -- --
--   >>> show <$> Left 17
--   Left 17
--   
--   >>> show <$> Right 17
--   Right "17"
--   
-- -- Double each element of a list: -- --
--   >>> (*2) <$> [1,2,3]
--   [2,4,6]
--   
-- -- Apply even to the second element of a pair: -- --
--   >>> even <$> (2,2)
--   (2,True)
--   
(<$>) :: Functor f => (a -> b) -> f a -> f b infixl 4 <$> -- | A bifunctor is a type constructor that takes two type arguments and is -- a functor in both arguments. That is, unlike with -- Functor, a type constructor such as Either does not need -- to be partially applied for a Bifunctor instance, and the -- methods in this class permit mapping functions over the Left -- value or the Right value, or both at the same time. -- -- Formally, the class Bifunctor represents a bifunctor from -- Hask -> Hask. -- -- Intuitively it is a bifunctor where both the first and second -- arguments are covariant. -- -- You can define a Bifunctor by either defining bimap or -- by defining both first and second. -- -- If you supply bimap, you should ensure that: -- --
--   bimap id idid
--   
-- -- If you supply first and second, ensure: -- --
--   first idid
--   second idid
--   
-- -- If you supply both, you should also ensure: -- --
--   bimap f g ≡ first f . second g
--   
-- -- These ensure by parametricity: -- --
--   bimap  (f . g) (h . i) ≡ bimap f h . bimap g i
--   first  (f . g) ≡ first  f . first  g
--   second (f . g) ≡ second f . second g
--   
class Bifunctor (p :: Type -> Type -> Type) -- | Map over both arguments at the same time. -- --
--   bimap f g ≡ first f . second g
--   
-- --

Examples

-- --
--   >>> bimap toUpper (+1) ('j', 3)
--   ('J',4)
--   
-- --
--   >>> bimap toUpper (+1) (Left 'j')
--   Left 'J'
--   
-- --
--   >>> bimap toUpper (+1) (Right 3)
--   Right 4
--   
bimap :: Bifunctor p => (a -> b) -> (c -> d) -> p a c -> p b d -- | Map covariantly over the first argument. -- --
--   first f ≡ bimap f id
--   
-- --

Examples

-- --
--   >>> first toUpper ('j', 3)
--   ('J',3)
--   
-- --
--   >>> first toUpper (Left 'j')
--   Left 'J'
--   
first :: Bifunctor p => (a -> b) -> p a c -> p b c -- | Map covariantly over the second argument. -- --
--   secondbimap id
--   
-- --

Examples

-- --
--   >>> second (+1) ('j', 3)
--   ('j',4)
--   
-- --
--   >>> second (+1) (Right 3)
--   Right 4
--   
second :: Bifunctor p => (b -> c) -> p a b -> p a c -- | A monoid on applicative functors. -- -- If defined, some and many should be the least solutions -- of the equations: -- -- class Applicative f => Alternative (f :: Type -> Type) -- | The identity of <|> empty :: Alternative f => f a -- | An associative binary operation (<|>) :: Alternative f => f a -> f a -> f a -- | One or more. some :: Alternative f => f a -> f [a] -- | Zero or more. many :: Alternative f => f a -> f [a] infixl 3 <|> -- | Monads that also support choice and failure. class (Alternative m, Monad m) => MonadPlus (m :: Type -> Type) -- | The identity of mplus. It should also satisfy the equations -- --
--   mzero >>= f  =  mzero
--   v >> mzero   =  mzero
--   
-- -- The default definition is -- --
--   mzero = empty
--   
mzero :: MonadPlus m => m a -- | An associative operation. The default definition is -- --
--   mplus = (<|>)
--   
mplus :: MonadPlus m => m a -> m a -> m a -- | Monads in which IO computations may be embedded. Any monad -- built by applying a sequence of monad transformers to the IO -- monad will be an instance of this class. -- -- Instances should satisfy the following laws, which state that -- liftIO is a transformer of monads: -- -- class Monad m => MonadIO (m :: Type -> Type) -- | Lift a computation from the IO monad. liftIO :: MonadIO m => IO a -> m a -- | Direct MonadPlus equivalent of filter. -- --

Examples

-- -- The filter function is just mfilter specialized to the -- list monad: -- --
--   filter = ( mfilter :: (a -> Bool) -> [a] -> [a] )
--   
-- -- An example using mfilter with the Maybe monad: -- --
--   >>> mfilter odd (Just 1)
--   Just 1
--   >>> mfilter odd (Just 2)
--   Nothing
--   
mfilter :: MonadPlus m => (a -> Bool) -> m a -> m a -- | Strict version of <$>. (<$!>) :: Monad m => (a -> b) -> m a -> m b infixl 4 <$!> -- | The reverse of when. unless :: Applicative f => Bool -> f () -> f () -- | Like replicateM, but discards the result. replicateM_ :: Applicative m => Int -> m a -> m () -- | replicateM n act performs the action n times, -- gathering the results. -- -- Using ApplicativeDo: 'replicateM 5 as' can be -- understood as the do expression -- --
--   do a1 <- as
--      a2 <- as
--      a3 <- as
--      a4 <- as
--      a5 <- as
--      pure [a1,a2,a3,a4,a5]
--   
-- -- Note the Applicative constraint. replicateM :: Applicative m => Int -> m a -> m [a] -- | Like foldM, but discards the result. foldM_ :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m () -- | The foldM function is analogous to foldl, except that -- its result is encapsulated in a monad. Note that foldM works -- from left-to-right over the list arguments. This could be an issue -- where (>>) and the `folded function' are not -- commutative. -- --
--   foldM f a1 [x1, x2, ..., xm]
--   
--   ==
--   
--   do
--     a2 <- f a1 x1
--     a3 <- f a2 x2
--     ...
--     f am xm
--   
-- -- If right-to-left evaluation is required, the input list should be -- reversed. -- -- Note: foldM is the same as foldlM foldM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b -- | zipWithM_ is the extension of zipWithM which ignores the -- final result. zipWithM_ :: Applicative m => (a -> b -> m c) -> [a] -> [b] -> m () -- | The zipWithM function generalizes zipWith to arbitrary -- applicative functors. zipWithM :: Applicative m => (a -> b -> m c) -> [a] -> [b] -> m [c] -- | The mapAndUnzipM function maps its first argument over a list, -- returning the result as a pair of lists. This function is mainly used -- with complicated data structures or a state monad. mapAndUnzipM :: Applicative m => (a -> m (b, c)) -> [a] -> m ([b], [c]) -- | Repeat an action indefinitely. -- -- Using ApplicativeDo: 'forever as' can be -- understood as the pseudo-do expression -- --
--   do as
--      as
--      ..
--   
-- -- with as repeating. -- --

Examples

-- -- A common use of forever is to process input from network -- sockets, Handles, and channels (e.g. MVar and -- Chan). -- -- For example, here is how we might implement an echo server, -- using forever both to listen for client connections on a -- network socket and to echo client input on client connection handles: -- --
--   echoServer :: Socket -> IO ()
--   echoServer socket = forever $ do
--     client <- accept socket
--     forkFinally (echo client) (\_ -> hClose client)
--     where
--       echo :: Handle -> IO ()
--       echo client = forever $
--         hGetLine client >>= hPutStrLn client
--   
forever :: Applicative f => f a -> f b -- | Right-to-left composition of Kleisli arrows. -- (>=>), with the arguments flipped. -- -- Note how this operator resembles function composition -- (.): -- --
--   (.)   ::            (b ->   c) -> (a ->   b) -> a ->   c
--   (<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c
--   
(<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c infixr 1 <=< -- | Left-to-right composition of Kleisli arrows. -- -- '(bs >=> cs) a' can be understood as the -- do expression -- --
--   do b <- bs a
--      cs b
--   
(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c infixr 1 >=> -- | This generalizes the list-based filter function. filterM :: Applicative m => (a -> m Bool) -> [a] -> m [a] -- | This function may be used as a value for foldMap in a -- Foldable instance. -- --
--   foldMapDefault f ≡ getConst . traverse (Const . f)
--   
foldMapDefault :: (Traversable t, Monoid m) => (a -> m) -> t a -> m -- | This function may be used as a value for fmap in a -- Functor instance, provided that traverse is defined. -- (Using fmapDefault with a Traversable instance defined -- only by sequenceA will result in infinite recursion.) -- --
--   fmapDefault f ≡ runIdentity . traverse (Identity . f)
--   
fmapDefault :: Traversable t => (a -> b) -> t a -> t b -- | The mapAccumR function behaves like a combination of -- fmap and foldr; it applies a function to each element of -- a structure, passing an accumulating parameter from right to left, and -- returning a final value of this accumulator together with the new -- structure. mapAccumR :: Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c) -- | The mapAccumL function behaves like a combination of -- fmap and foldl; it applies a function to each element of -- a structure, passing an accumulating parameter from left to right, and -- returning a final value of this accumulator together with the new -- structure. mapAccumL :: Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c) -- | forM is mapM with its arguments flipped. For a version -- that ignores the results see forM_. forM :: (Traversable t, Monad m) => t a -> (a -> m b) -> m (t b) -- | for is traverse with its arguments flipped. For a -- version that ignores the results see for_. for :: (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b) -- | One or none. optional :: Alternative f => f a -> f (Maybe a) newtype WrappedMonad (m :: Type -> Type) a WrapMonad :: m a -> WrappedMonad (m :: Type -> Type) a [unwrapMonad] :: WrappedMonad (m :: Type -> Type) a -> m a newtype WrappedArrow (a :: Type -> Type -> Type) b c WrapArrow :: a b c -> WrappedArrow (a :: Type -> Type -> Type) b c [unwrapArrow] :: WrappedArrow (a :: Type -> Type -> Type) b c -> a b c -- | Lists, but with an Applicative functor based on zipping. newtype ZipList a ZipList :: [a] -> ZipList a [getZipList] :: ZipList a -> [a] -- | Any type that you wish to throw or catch as an exception must be an -- instance of the Exception class. The simplest case is a new -- exception type directly below the root: -- --
--   data MyException = ThisException | ThatException
--       deriving Show
--   
--   instance Exception MyException
--   
-- -- The default method definitions in the Exception class do what -- we need in this case. You can now throw and catch -- ThisException and ThatException as exceptions: -- --
--   *Main> throw ThisException `catch` \e -> putStrLn ("Caught " ++ show (e :: MyException))
--   Caught ThisException
--   
-- -- In more complicated examples, you may wish to define a whole hierarchy -- of exceptions: -- --
--   ---------------------------------------------------------------------
--   -- Make the root exception type for all the exceptions in a compiler
--   
--   data SomeCompilerException = forall e . Exception e => SomeCompilerException e
--   
--   instance Show SomeCompilerException where
--       show (SomeCompilerException e) = show e
--   
--   instance Exception SomeCompilerException
--   
--   compilerExceptionToException :: Exception e => e -> SomeException
--   compilerExceptionToException = toException . SomeCompilerException
--   
--   compilerExceptionFromException :: Exception e => SomeException -> Maybe e
--   compilerExceptionFromException x = do
--       SomeCompilerException a <- fromException x
--       cast a
--   
--   ---------------------------------------------------------------------
--   -- Make a subhierarchy for exceptions in the frontend of the compiler
--   
--   data SomeFrontendException = forall e . Exception e => SomeFrontendException e
--   
--   instance Show SomeFrontendException where
--       show (SomeFrontendException e) = show e
--   
--   instance Exception SomeFrontendException where
--       toException = compilerExceptionToException
--       fromException = compilerExceptionFromException
--   
--   frontendExceptionToException :: Exception e => e -> SomeException
--   frontendExceptionToException = toException . SomeFrontendException
--   
--   frontendExceptionFromException :: Exception e => SomeException -> Maybe e
--   frontendExceptionFromException x = do
--       SomeFrontendException a <- fromException x
--       cast a
--   
--   ---------------------------------------------------------------------
--   -- Make an exception type for a particular frontend compiler exception
--   
--   data MismatchedParentheses = MismatchedParentheses
--       deriving Show
--   
--   instance Exception MismatchedParentheses where
--       toException   = frontendExceptionToException
--       fromException = frontendExceptionFromException
--   
-- -- We can now catch a MismatchedParentheses exception as -- MismatchedParentheses, SomeFrontendException or -- SomeCompilerException, but not other types, e.g. -- IOException: -- --
--   *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: MismatchedParentheses))
--   Caught MismatchedParentheses
--   *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: SomeFrontendException))
--   Caught MismatchedParentheses
--   *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: SomeCompilerException))
--   Caught MismatchedParentheses
--   *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: IOException))
--   *** Exception: MismatchedParentheses
--   
class (Typeable e, Show e) => Exception e typeOf7 :: Typeable t => t a b c d e f g -> TypeRep typeOf6 :: Typeable t => t a b c d e f -> TypeRep typeOf5 :: Typeable t => t a b c d e -> TypeRep typeOf4 :: Typeable t => t a b c d -> TypeRep typeOf3 :: Typeable t => t a b c -> TypeRep typeOf2 :: Typeable t => t a b -> TypeRep typeOf1 :: Typeable t => t a -> TypeRep -- | Force a TypeRep to normal form. rnfTypeRep :: TypeRep -> () -- | Takes a value of type a and returns a concrete representation -- of that type. typeRepFingerprint :: TypeRep -> Fingerprint -- | Observe the type constructor of a quantified type representation. typeRepTyCon :: TypeRep -> TyCon -- | Observe the argument types of a type representation typeRepArgs :: TypeRep -> [TypeRep] -- | Splits a type constructor application. Note that if the type -- constructor is polymorphic, this will not return the kinds that were -- used. splitTyConApp :: TypeRep -> (TyCon, [TypeRep]) -- | Build a function type. mkFunTy :: TypeRep -> TypeRep -> TypeRep -- | Applies a type to a function type. Returns: Just u if the -- first argument represents a function of type t -> u and -- the second argument represents a function of type t. -- Otherwise, returns Nothing. funResultTy :: TypeRep -> TypeRep -> Maybe TypeRep -- | Cast over k1 -> k2 -> k3 gcast2 :: forall k1 k2 k3 c (t :: k2 -> k3 -> k1) (t' :: k2 -> k3 -> k1) (a :: k2) (b :: k3). (Typeable t, Typeable t') => c (t a b) -> Maybe (c (t' a b)) -- | Cast over k1 -> k2 gcast1 :: forall k1 k2 c (t :: k2 -> k1) (t' :: k2 -> k1) (a :: k2). (Typeable t, Typeable t') => c (t a) -> Maybe (c (t' a)) -- | A flexible variation parameterised in a type constructor gcast :: forall k (a :: k) (b :: k) c. (Typeable a, Typeable b) => c a -> Maybe (c b) -- | Extract a witness of equality of two types eqT :: forall k (a :: k) (b :: k). (Typeable a, Typeable b) => Maybe (a :~: b) -- | The type-safe cast operation cast :: (Typeable a, Typeable b) => a -> Maybe b -- | Show a type representation showsTypeRep :: TypeRep -> ShowS -- | Takes a value of type a and returns a concrete representation -- of that type. typeRep :: forall k proxy (a :: k). Typeable a => proxy a -> TypeRep -- | Observe a type representation for the type of a value. typeOf :: Typeable a => a -> TypeRep -- | A quantified type representation. type TypeRep = SomeTypeRep rnfTyCon :: TyCon -> () tyConFingerprint :: TyCon -> Fingerprint tyConName :: TyCon -> String tyConModule :: TyCon -> String tyConPackage :: TyCon -> String -- | The Const functor. newtype Const a (b :: k) Const :: a -> Const a (b :: k) [getConst] :: Const a (b :: k) -> a -- | The find function takes a predicate and a structure and returns -- the leftmost element of the structure matching the predicate, or -- Nothing if there is no such element. find :: Foldable t => (a -> Bool) -> t a -> Maybe a -- | notElem is the negation of elem. notElem :: (Foldable t, Eq a) => a -> t a -> Bool infix 4 `notElem` -- | The least element of a non-empty structure with respect to the given -- comparison function. minimumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a -- | The largest element of a non-empty structure with respect to the given -- comparison function. maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a -- | Determines whether all elements of the structure satisfy the -- predicate. all :: Foldable t => (a -> Bool) -> t a -> Bool -- | Determines whether any element of the structure satisfies the -- predicate. any :: Foldable t => (a -> Bool) -> t a -> Bool -- | or returns the disjunction of a container of Bools. For the -- result to be False, the container must be finite; True, -- however, results from a True value finitely far from the left -- end. or :: Foldable t => t Bool -> Bool -- | and returns the conjunction of a container of Bools. For the -- result to be True, the container must be finite; False, -- however, results from a False value finitely far from the left -- end. and :: Foldable t => t Bool -> Bool -- | Map a function over all the elements of a container and concatenate -- the resulting lists. concatMap :: Foldable t => (a -> [b]) -> t a -> [b] -- | The concatenation of all the elements of a container of lists. concat :: Foldable t => t [a] -> [a] -- | The sum of a collection of actions, generalizing concat. As of -- base 4.8.0.0, msum is just asum, specialized to -- MonadPlus. msum :: (Foldable t, MonadPlus m) => t (m a) -> m a -- | The sum of a collection of actions, generalizing concat. -- --
--   >>> asum [Just "Hello", Nothing, Just "World"]
--   Just "Hello"
--   
asum :: (Foldable t, Alternative f) => t (f a) -> f a -- | Evaluate each monadic action in the structure from left to right, and -- ignore the results. For a version that doesn't ignore the results see -- sequence. -- -- As of base 4.8.0.0, sequence_ is just sequenceA_, -- specialized to Monad. sequence_ :: (Foldable t, Monad m) => t (m a) -> m () -- | Evaluate each action in the structure from left to right, and ignore -- the results. For a version that doesn't ignore the results see -- sequenceA. sequenceA_ :: (Foldable t, Applicative f) => t (f a) -> f () -- | forM_ is mapM_ with its arguments flipped. For a version -- that doesn't ignore the results see forM. -- -- As of base 4.8.0.0, forM_ is just for_, specialized to -- Monad. forM_ :: (Foldable t, Monad m) => t a -> (a -> m b) -> m () -- | Map each element of a structure to a monadic action, evaluate these -- actions from left to right, and ignore the results. For a version that -- doesn't ignore the results see mapM. -- -- As of base 4.8.0.0, mapM_ is just traverse_, specialized -- to Monad. mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m () -- | for_ is traverse_ with its arguments flipped. For a -- version that doesn't ignore the results see for. -- --
--   >>> for_ [1..4] print
--   1
--   2
--   3
--   4
--   
for_ :: (Foldable t, Applicative f) => t a -> (a -> f b) -> f () -- | Map each element of a structure to an action, evaluate these actions -- from left to right, and ignore the results. For a version that doesn't -- ignore the results see traverse. traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f () -- | Monadic fold over the elements of a structure, associating to the -- left, i.e. from left to right. foldlM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b -- | Monadic fold over the elements of a structure, associating to the -- right, i.e. from right to left. foldrM :: (Foldable t, Monad m) => (a -> b -> m b) -> b -> t a -> m b -- | Proxy is a type that holds no data, but has a phantom parameter -- of arbitrary type (or even kind). Its use is to provide type -- information, even though there is no value available of that type (or -- it may be too costly to create one). -- -- Historically, Proxy :: Proxy a is a safer -- alternative to the undefined :: a idiom. -- --
--   >>> Proxy :: Proxy (Void, Int -> Int)
--   Proxy
--   
-- -- Proxy can even hold types of higher kinds, -- --
--   >>> Proxy :: Proxy Either
--   Proxy
--   
-- --
--   >>> Proxy :: Proxy Functor
--   Proxy
--   
-- --
--   >>> Proxy :: Proxy complicatedStructure
--   Proxy
--   
data Proxy (t :: k) Proxy :: Proxy (t :: k) -- | Propositional equality. If a :~: b is inhabited by some -- terminating value, then the type a is the same as the type -- b. To use this equality in practice, pattern-match on the -- a :~: b to get out the Refl constructor; in the body -- of the pattern-match, the compiler knows that a ~ b. data (a :: k) :~: (b :: k) [Refl] :: forall k (a :: k). a :~: a infix 4 :~: -- | Kind heterogeneous propositional equality. Like :~:, a :~~: -- b is inhabited by a terminating value if and only if a -- is the same type as b. data (a :: k1) :~~: (b :: k2) [HRefl] :: forall k1 (a :: k1). a :~~: a infix 4 :~~: -- | The catMaybes function takes a list of Maybes and -- returns a list of all the Just values. -- --

Examples

-- -- Basic usage: -- --
--   >>> catMaybes [Just 1, Nothing, Just 3]
--   [1,3]
--   
-- -- When constructing a list of Maybe values, catMaybes can -- be used to return all of the "success" results (if the list is the -- result of a map, then mapMaybe would be more -- appropriate): -- --
--   >>> import Text.Read ( readMaybe )
--   
--   >>> [readMaybe x :: Maybe Int | x <- ["1", "Foo", "3"] ]
--   [Just 1,Nothing,Just 3]
--   
--   >>> catMaybes $ [readMaybe x :: Maybe Int | x <- ["1", "Foo", "3"] ]
--   [1,3]
--   
catMaybes :: [Maybe a] -> [a] -- | The fromMaybe function takes a default value and and -- Maybe value. If the Maybe is Nothing, it returns -- the default values; otherwise, it returns the value contained in the -- Maybe. -- --

Examples

-- -- Basic usage: -- --
--   >>> fromMaybe "" (Just "Hello, World!")
--   "Hello, World!"
--   
-- --
--   >>> fromMaybe "" Nothing
--   ""
--   
-- -- Read an integer from a string using readMaybe. If we fail to -- parse an integer, we want to return 0 by default: -- --
--   >>> import Text.Read ( readMaybe )
--   
--   >>> fromMaybe 0 (readMaybe "5")
--   5
--   
--   >>> fromMaybe 0 (readMaybe "")
--   0
--   
fromMaybe :: a -> Maybe a -> a -- | void value discards or ignores the result of -- evaluation, such as the return value of an IO action. -- -- Using ApplicativeDo: 'void as' can be -- understood as the do expression -- --
--   do as
--      pure ()
--   
-- -- with an inferred Functor constraint. -- --

Examples

-- -- Replace the contents of a Maybe Int with unit: -- --
--   >>> void Nothing
--   Nothing
--   
--   >>> void (Just 3)
--   Just ()
--   
-- -- Replace the contents of an Either Int -- Int with unit, resulting in an Either -- Int (): -- --
--   >>> void (Left 8675309)
--   Left 8675309
--   
--   >>> void (Right 8675309)
--   Right ()
--   
-- -- Replace every element of a list with unit: -- --
--   >>> void [1,2,3]
--   [(),(),()]
--   
-- -- Replace the second element of a pair with unit: -- --
--   >>> void (1,2)
--   (1,())
--   
-- -- Discard the result of an IO action: -- --
--   >>> mapM print [1,2]
--   1
--   2
--   [(),()]
--   
--   >>> void $ mapM print [1,2]
--   1
--   2
--   
void :: Functor f => f a -> f () -- | Flipped version of <$. -- -- Using ApplicativeDo: 'as $> b' can be -- understood as the do expression -- --
--   do as
--      pure b
--   
-- -- with an inferred Functor constraint. -- --

Examples

-- -- Replace the contents of a Maybe Int with a -- constant String: -- --
--   >>> Nothing $> "foo"
--   Nothing
--   
--   >>> Just 90210 $> "foo"
--   Just "foo"
--   
-- -- Replace the contents of an Either Int -- Int with a constant String, resulting in an -- Either Int String: -- --
--   >>> Left 8675309 $> "foo"
--   Left 8675309
--   
--   >>> Right 8675309 $> "foo"
--   Right "foo"
--   
-- -- Replace each element of a list with a constant String: -- --
--   >>> [1,2,3] $> "foo"
--   ["foo","foo","foo"]
--   
-- -- Replace the second element of a pair with a constant String: -- --
--   >>> (1,2) $> "foo"
--   (1,"foo")
--   
($>) :: Functor f => f a -> b -> f b infixl 4 $> -- | Flipped version of <$>. -- --
--   (<&>) = flip fmap
--   
-- --

Examples

-- -- Apply (+1) to a list, a Just and a Right: -- --
--   >>> Just 2 <&> (+1)
--   Just 3
--   
-- --
--   >>> [1,2,3] <&> (+1)
--   [2,3,4]
--   
-- --
--   >>> Right 3 <&> (+1)
--   Right 4
--   
(<&>) :: Functor f => f a -> (a -> b) -> f b infixl 1 <&> -- | In many situations, the liftM operations can be replaced by -- uses of ap, which promotes function application. -- --
--   return f `ap` x1 `ap` ... `ap` xn
--   
-- -- is equivalent to -- --
--   liftMn f x1 x2 ... xn
--   
ap :: Monad m => m (a -> b) -> m a -> m b -- | Promote a function to a monad, scanning the monadic arguments from -- left to right (cf. liftM2). liftM5 :: Monad m => (a1 -> a2 -> a3 -> a4 -> a5 -> r) -> m a1 -> m a2 -> m a3 -> m a4 -> m a5 -> m r -- | Promote a function to a monad, scanning the monadic arguments from -- left to right (cf. liftM2). liftM4 :: Monad m => (a1 -> a2 -> a3 -> a4 -> r) -> m a1 -> m a2 -> m a3 -> m a4 -> m r -- | Promote a function to a monad, scanning the monadic arguments from -- left to right (cf. liftM2). liftM3 :: Monad m => (a1 -> a2 -> a3 -> r) -> m a1 -> m a2 -> m a3 -> m r -- | Promote a function to a monad, scanning the monadic arguments from -- left to right. For example, -- --
--   liftM2 (+) [0,1] [0,2] = [0,2,1,3]
--   liftM2 (+) (Just 1) Nothing = Nothing
--   
liftM2 :: Monad m => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r -- | Conditional execution of Applicative expressions. For example, -- --
--   when debug (putStrLn "Debugging")
--   
-- -- will output the string Debugging if the Boolean value -- debug is True, and otherwise do nothing. when :: Applicative f => Bool -> f () -> f () -- | Same as >>=, but with the arguments interchanged. (=<<) :: Monad m => (a -> m b) -> m a -> m b infixr 1 =<< -- | Lift a ternary function to actions. -- -- Using ApplicativeDo: 'liftA3 f as bs cs' can -- be understood as the do expression -- --
--   do a <- as
--      b <- bs
--      c <- cs
--      pure (f a b c)
--   
liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d -- | Lift a function to actions. This function may be used as a value for -- fmap in a Functor instance. -- -- | Using ApplicativeDo: 'liftA f as' can be -- understood as the do expression -- --
--   do a <- as
--      pure (f a)
--   
-- -- with an inferred Functor constraint, weaker than -- Applicative. liftA :: Applicative f => (a -> b) -> f a -> f b -- | A variant of <*> with the arguments reversed. -- -- Using ApplicativeDo: 'as <**> fs' can -- be understood as the do expression -- --
--   do a <- as
--      f <- fs
--      pure (f a)
--   
(<**>) :: Applicative f => f a -> f (a -> b) -> f b infixl 4 <**> -- | Decode a ByteString containing UTF-8 encoded text. -- -- NOTE: The replacement character returned by -- OnDecodeError MUST be within the BMP plane; surrogate code -- points will automatically be remapped to the replacement char -- U+FFFD (since 0.11.3.0), whereas code points beyond -- the BMP will throw an error (since 1.2.3.1); For earlier -- versions of text using those unsupported code points would -- result in undefined behavior. decodeUtf8With :: OnDecodeError -> ByteString -> Text -- | Replace an invalid input byte with the Unicode replacement character -- U+FFFD. lenientDecode :: OnDecodeError -- | Boxed vectors, supporting efficient slicing. data Vector a -- | A space efficient, packed, unboxed Unicode text type. data Text -- | A space-efficient representation of a Word8 vector, supporting -- many efficient operations. -- -- A ByteString contains 8-bit bytes, or by using the operations -- from Data.ByteString.Char8 it can be interpreted as containing -- 8-bit characters. data ByteString module Preql.QuasiQuoter.Common -- | A list of n Names beginning with the given character cNames :: Char -> Int -> Q [Name] tupleOrSingle :: [Name] -> Exp expressionOnly :: String -> (String -> Q Exp) -> QuasiQuoter alphabet :: [String] tupleE :: [Exp] -> Exp module Preql.QuasiQuoter.Raw.Lex alexIndexInt32OffAddr :: AlexAddr -> Int# -> Int# quickIndex :: Array Int (AlexAcc (Any :: Type)) -> Int -> AlexAcc (Any :: Type) data AlexReturn a AlexEOF :: AlexReturn a AlexError :: !AlexInput -> AlexReturn a AlexSkip :: !AlexInput -> !Int -> AlexReturn a AlexToken :: !AlexInput -> !Int -> a -> AlexReturn a alexScan :: (AlexPosn, Char, [Byte], String) -> Int -> AlexReturn (AlexAction LocToken) alexScanUser :: t -> (AlexPosn, Char, [Byte], String) -> Int -> AlexReturn (AlexAction LocToken) alex_scan_tkn :: t1 -> t2 -> Int# -> AlexInput -> Int# -> AlexLastAcc -> (AlexLastAcc, (AlexPosn, Char, [Byte], String)) data AlexLastAcc AlexNone :: AlexLastAcc AlexLastAcc :: !Int -> !AlexInput -> !Int -> AlexLastAcc AlexLastSkip :: !AlexInput -> !Int -> AlexLastAcc data AlexAcc user AlexAccNone :: AlexAcc user AlexAcc :: Int -> AlexAcc user AlexAccSkip :: AlexAcc user data LocToken LocToken :: AlexPosn -> Token -> LocToken [loc] :: LocToken -> AlexPosn [unLoc] :: LocToken -> Token data Token Sql :: String -> Token NumberedParam :: Word -> Token HaskellParam :: String -> Token EOF :: Token data AlexUserState AlexUserState :: FilePath -> AlexUserState [filePath] :: AlexUserState -> FilePath alexInitUserState :: AlexUserState getFilePath :: Alex FilePath setFilePath :: FilePath -> Alex () unLex :: Token -> String lex' :: (String -> Token) -> AlexAction LocToken alexMonadScan' :: Alex LocToken alexEOF :: Alex LocToken alexError' :: AlexPosn -> String -> Alex a runAlex' :: Alex a -> FilePath -> String -> Either String a lexAll :: Alex [LocToken] parseQuery' :: FilePath -> String -> Either String [LocToken] parseQuery :: FilePath -> String -> Either String [Token] alex_action_0 :: AlexAction LocToken alex_action_1 :: AlexAction LocToken alex_action_2 :: AlexAction LocToken data AlexAddr AlexA# :: Addr# -> AlexAddr alexIndexInt16OffAddr :: AlexAddr -> Int# -> Int# -- | Encode a Haskell String to a list of Word8 values, in UTF8 format. utf8Encode :: Char -> [Word8] type Byte = Word8 type AlexInput = (AlexPosn, Char, [Byte], String) ignorePendingBytes :: AlexInput -> AlexInput alexInputPrevChar :: AlexInput -> Char alexGetByte :: AlexInput -> Maybe (Byte, AlexInput) data AlexPosn AlexPn :: !Int -> !Int -> !Int -> AlexPosn alexStartPos :: AlexPosn alexMove :: AlexPosn -> Char -> AlexPosn data AlexState AlexState :: !AlexPosn -> String -> !Char -> [Byte] -> !Int -> AlexUserState -> AlexState [alex_pos] :: AlexState -> !AlexPosn [alex_inp] :: AlexState -> String [alex_chr] :: AlexState -> !Char [alex_bytes] :: AlexState -> [Byte] [alex_scd] :: AlexState -> !Int [alex_ust] :: AlexState -> AlexUserState runAlex :: String -> Alex a -> Either String a newtype Alex a Alex :: (AlexState -> Either String (AlexState, a)) -> Alex a [unAlex] :: Alex a -> AlexState -> Either String (AlexState, a) alexGetInput :: Alex AlexInput alexSetInput :: AlexInput -> Alex () alexError :: String -> Alex a alexGetStartCode :: Alex Int alexSetStartCode :: Int -> Alex () alexGetUserState :: Alex AlexUserState alexSetUserState :: AlexUserState -> Alex () alexMonadScan :: Alex LocToken type AlexAction result = AlexInput -> Int -> Alex result skip :: p1 -> p2 -> Alex LocToken begin :: Int -> p1 -> p2 -> Alex LocToken andBegin :: AlexAction result -> Int -> AlexAction result token :: (AlexInput -> Int -> token) -> AlexAction token alex_tab_size :: Int alex_base :: AlexAddr alex_table :: AlexAddr alex_check :: AlexAddr alex_deflt :: AlexAddr alex_accept :: Array Int (AlexAcc user) alex_actions :: Array Int (AlexAction LocToken) instance GHC.Show.Show Preql.QuasiQuoter.Raw.Lex.AlexPosn instance GHC.Classes.Eq Preql.QuasiQuoter.Raw.Lex.AlexPosn instance GHC.Classes.Ord Preql.QuasiQuoter.Raw.Lex.Token instance GHC.Classes.Eq Preql.QuasiQuoter.Raw.Lex.Token instance GHC.Show.Show Preql.QuasiQuoter.Raw.Lex.Token instance GHC.Show.Show Preql.QuasiQuoter.Raw.Lex.LocToken instance GHC.Base.Functor Preql.QuasiQuoter.Raw.Lex.Alex instance GHC.Base.Applicative Preql.QuasiQuoter.Raw.Lex.Alex instance GHC.Base.Monad Preql.QuasiQuoter.Raw.Lex.Alex module Preql.QuasiQuoter.Syntax.Lex alexIndexInt32OffAddr :: AlexAddr -> Int# -> Int# quickIndex :: Array Int (AlexAcc (Any :: Type)) -> Int -> AlexAcc (Any :: Type) data AlexReturn a AlexEOF :: AlexReturn a AlexError :: !AlexInput -> AlexReturn a AlexSkip :: !AlexInput -> !Int -> AlexReturn a AlexToken :: !AlexInput -> !Int -> a -> AlexReturn a alexScan :: (AlexPosn, Char, [Byte], String) -> Int -> AlexReturn (AlexAction LocToken) alexScanUser :: t -> (AlexPosn, Char, [Byte], String) -> Int -> AlexReturn (AlexAction LocToken) alex_scan_tkn :: t1 -> t2 -> Int# -> AlexInput -> Int# -> AlexLastAcc -> (AlexLastAcc, (AlexPosn, Char, [Byte], String)) data AlexLastAcc AlexNone :: AlexLastAcc AlexLastAcc :: !Int -> !AlexInput -> !Int -> AlexLastAcc AlexLastSkip :: !AlexInput -> !Int -> AlexLastAcc data AlexAcc user AlexAccNone :: AlexAcc user AlexAcc :: Int -> AlexAcc user AlexAccSkip :: AlexAcc user data LocToken LocToken :: AlexPosn -> Token -> LocToken [loc] :: LocToken -> AlexPosn [unLoc] :: LocToken -> Token data Token Nulls :: Token First :: Token Name :: Text -> Token String :: Text -> Token Iconst :: Word -> Token Fconst :: Double -> Token NumberedParam :: Word -> Token HaskellParam :: Text -> Token LParen :: Token RParen :: Token Comma :: Token Mul :: Token Div :: Token Add :: Token Sub :: Token Mod :: Token Exponent :: Token Equals :: Token NotEquals :: Token LT :: Token LTE :: Token GT :: Token GTE :: Token Dot :: Token Semicolon :: Token EOF :: Token COLON_EQUALS :: Token EQUALS_GREATER :: Token ABORT_P :: Token AUTHORIZATION :: Token BETWEEN :: Token ABSOLUTE_P :: Token ACCESS :: Token ACTION :: Token ADD_P :: Token ADMIN :: Token AFTER :: Token AGGREGATE :: Token ALL :: Token ALSO :: Token ALTER :: Token ALWAYS :: Token ANALYSE :: Token ANALYZE :: Token AND :: Token ANY :: Token ARRAY :: Token AS :: Token ASC :: Token ASSERTION :: Token ASSIGNMENT :: Token ASYMMETRIC :: Token AT :: Token ATTACH :: Token ATTRIBUTE :: Token BACKWARD :: Token BEFORE :: Token BEGIN_P :: Token BIGINT :: Token BINARY :: Token BIT :: Token BOOLEAN_P :: Token BOTH :: Token BY :: Token CACHE :: Token CALL :: Token CALLED :: Token CASCADE :: Token CASCADED :: Token CASE :: Token CAST :: Token CATALOG_P :: Token CHAIN :: Token CHARACTER :: Token CHARACTERISTICS :: Token CHAR_P :: Token CHECK :: Token CHECKPOINT :: Token CLASS :: Token CLOSE :: Token CLUSTER :: Token COALESCE :: Token COLLATE :: Token COLLATION :: Token COLUMN :: Token COLUMNS :: Token COMMENT :: Token COMMENTS :: Token COMMIT :: Token COMMITTED :: Token CONCURRENTLY :: Token CONFIGURATION :: Token CONFLICT :: Token CONNECTION :: Token CONSTRAINT :: Token CONSTRAINTS :: Token CONTENT_P :: Token CONTINUE_P :: Token CONVERSION_P :: Token COPY :: Token COST :: Token CREATE :: Token CROSS :: Token CSV :: Token CUBE :: Token CURRENT_CATALOG :: Token CURRENT_DATE :: Token CURRENT_P :: Token CURRENT_ROLE :: Token CURRENT_SCHEMA :: Token CURRENT_TIME :: Token CURRENT_TIMESTAMP :: Token CURRENT_USER :: Token CURSOR :: Token CYCLE :: Token DATABASE :: Token DATA_P :: Token DAY_P :: Token DEALLOCATE :: Token DEC :: Token DECIMAL_P :: Token DECLARE :: Token DEFAULT :: Token DEFAULTS :: Token DEFERRABLE :: Token DEFERRED :: Token DEFINER :: Token DELETE_P :: Token DELIMITER :: Token DELIMITERS :: Token DEPENDS :: Token DESC :: Token DETACH :: Token DICTIONARY :: Token DISABLE_P :: Token DISCARD :: Token DISTINCT :: Token DO :: Token DOCUMENT_P :: Token DOMAIN_P :: Token DOUBLE_P :: Token DROP :: Token EACH :: Token ELSE :: Token ENABLE_P :: Token ENCODING :: Token ENCRYPTED :: Token END_P :: Token ENUM_P :: Token ESCAPE :: Token EVENT :: Token EXCEPT :: Token EXCLUDE :: Token EXCLUDING :: Token EXCLUSIVE :: Token EXECUTE :: Token EXISTS :: Token EXPLAIN :: Token EXTENSION :: Token EXTERNAL :: Token EXTRACT :: Token FALSE_P :: Token FAMILY :: Token FETCH :: Token FILTER :: Token FIRST_P :: Token FLOAT_P :: Token FOLLOWING :: Token FOR :: Token FORCE :: Token FOREIGN :: Token FORWARD :: Token FREEZE :: Token FROM :: Token FULL :: Token FUNCTION :: Token FUNCTIONS :: Token GENERATED :: Token GLOBAL :: Token GRANT :: Token GRANTED :: Token GREATEST :: Token GROUPING :: Token GROUPS :: Token GROUP_P :: Token HANDLER :: Token HAVING :: Token HEADER_P :: Token HOLD :: Token HOUR_P :: Token IDENTITY_P :: Token IF_P :: Token ILIKE :: Token IMMEDIATE :: Token IMMUTABLE :: Token IMPLICIT_P :: Token IMPORT_P :: Token INCLUDE :: Token INCLUDING :: Token INCREMENT :: Token INDEX :: Token INDEXES :: Token INHERIT :: Token INHERITS :: Token INITIALLY :: Token INLINE_P :: Token INNER_P :: Token INOUT :: Token INPUT_P :: Token INSENSITIVE :: Token INSERT :: Token INSTEAD :: Token INTEGER :: Token INTERSECT :: Token INTERVAL :: Token INTO :: Token INT_P :: Token INVOKER :: Token IN_P :: Token IS :: Token ISNULL :: Token ISOLATION :: Token JOIN :: Token KEY :: Token LABEL :: Token LANGUAGE :: Token LARGE_P :: Token LAST :: Token LATERAL_P :: Token LEADING :: Token LEAKPROOF :: Token LEAST :: Token LEFT :: Token LEVEL :: Token LIKE :: Token LIMIT :: Token LISTEN :: Token LOAD :: Token LOCAL :: Token LOCALTIME :: Token LOCALTIMESTAMP :: Token LOCATION :: Token LOCKED :: Token LOCK_P :: Token LOGGED :: Token MAPPING :: Token MATCH :: Token MATERIALIZED :: Token MAXVALUE :: Token METHOD :: Token MINUTE_P :: Token MINVALUE :: Token MODE :: Token MONTH_P :: Token MOVE :: Token NAMES :: Token NAME_P :: Token NATIONAL :: Token NATURAL :: Token NCHAR :: Token NEW :: Token NEXT :: Token NO :: Token NONE :: Token NOT :: Token NOTHING :: Token NOTIFY :: Token NOTNULL :: Token NOWAIT :: Token NULLIF :: Token NULLS_P :: Token NULL_P :: Token NUMERIC :: Token OBJECT_P :: Token OF :: Token OFF :: Token OFFSET :: Token OIDS :: Token OLD :: Token ON :: Token ONLY :: Token OPERATOR :: Token OPTION :: Token OPTIONS :: Token OR :: Token ORDER :: Token ORDINALITY :: Token OTHERS :: Token OUTER_P :: Token OUT_P :: Token OVER :: Token OVERLAPS :: Token OVERLAY :: Token OVERRIDING :: Token OWNED :: Token OWNER :: Token PARALLEL :: Token PARSER :: Token PARTIAL :: Token PARTITION :: Token PASSING :: Token PASSWORD :: Token PLACING :: Token PLANS :: Token POLICY :: Token POSITION :: Token PRECEDING :: Token PRECISION :: Token PREPARE :: Token PREPARED :: Token PRESERVE :: Token PRIMARY :: Token PRIOR :: Token PRIVILEGES :: Token PROCEDURAL :: Token PROCEDURE :: Token PROCEDURES :: Token PROGRAM :: Token PUBLICATION :: Token QUOTE :: Token RANGE :: Token READ :: Token REAL :: Token REASSIGN :: Token RECHECK :: Token RECURSIVE :: Token REF :: Token REFERENCES :: Token REFERENCING :: Token REFRESH :: Token REINDEX :: Token RELATIVE_P :: Token RELEASE :: Token RENAME :: Token REPEATABLE :: Token REPLACE :: Token REPLICA :: Token RESET :: Token RESTART :: Token RESTRICT :: Token RETURNING :: Token RETURNS :: Token REVOKE :: Token RIGHT :: Token ROLE :: Token ROLLBACK :: Token ROLLUP :: Token ROUTINE :: Token ROUTINES :: Token ROW :: Token ROWS :: Token RULE :: Token SAVEPOINT :: Token SCHEMA :: Token SCHEMAS :: Token SCROLL :: Token SEARCH :: Token SECOND_P :: Token SECURITY :: Token SELECT :: Token SEQUENCE :: Token SEQUENCES :: Token SERIALIZABLE :: Token SERVER :: Token SESSION :: Token SESSION_USER :: Token SET :: Token SETOF :: Token SETS :: Token SHARE :: Token SHOW :: Token SIMILAR :: Token SIMPLE :: Token SKIP :: Token SMALLINT :: Token SNAPSHOT :: Token SOME :: Token SQL_P :: Token STABLE :: Token STANDALONE_P :: Token START :: Token STATEMENT :: Token STATISTICS :: Token STDIN :: Token STDOUT :: Token STORAGE :: Token STORED :: Token STRICT_P :: Token STRIP_P :: Token SUBSCRIPTION :: Token SUBSTRING :: Token SUPPORT :: Token SYMMETRIC :: Token SYSID :: Token SYSTEM_P :: Token TABLE :: Token TABLES :: Token TABLESAMPLE :: Token TABLESPACE :: Token TEMP :: Token TEMPLATE :: Token TEMPORARY :: Token TEXT_P :: Token THEN :: Token TIES :: Token TIME :: Token TIMESTAMP :: Token TO :: Token TRAILING :: Token TRANSACTION :: Token TRANSFORM :: Token TREAT :: Token TRIGGER :: Token TRIM :: Token TRUE_P :: Token TRUNCATE :: Token TRUSTED :: Token TYPES_P :: Token TYPE_P :: Token UNBOUNDED :: Token UNCOMMITTED :: Token UNENCRYPTED :: Token UNION :: Token UNIQUE :: Token UNKNOWN :: Token UNLISTEN :: Token UNLOGGED :: Token UNTIL :: Token UPDATE :: Token USER :: Token USING :: Token VACUUM :: Token VALID :: Token VALIDATE :: Token VALIDATOR :: Token VALUES :: Token VALUE_P :: Token VARCHAR :: Token VARIADIC :: Token VARYING :: Token VERBOSE :: Token VERSION_P :: Token VIEW :: Token VIEWS :: Token VOLATILE :: Token WHEN :: Token WHERE :: Token WHITESPACE_P :: Token WINDOW :: Token WITH :: Token WITHIN :: Token WITHOUT :: Token WORK :: Token WRAPPER :: Token WRITE :: Token XMLATTRIBUTES :: Token XMLCONCAT :: Token XMLELEMENT :: Token XMLEXISTS :: Token XMLFOREST :: Token XMLNAMESPACES :: Token XMLPARSE :: Token XMLPI :: Token XMLROOT :: Token XMLSERIALIZE :: Token XMLTABLE :: Token XML_P :: Token YEAR_P :: Token YES_P :: Token ZONE :: Token data AlexUserState AlexUserState :: FilePath -> AlexUserState [filePath] :: AlexUserState -> FilePath alexInitUserState :: AlexUserState getFilePath :: Alex FilePath setFilePath :: FilePath -> Alex () unLex :: Token -> String -- | remove single quotes, and '' escape sequences unquoteString :: String -> String alexEOF :: Alex LocToken lex' :: (String -> Token) -> AlexAction LocToken lex :: Token -> AlexAction LocToken alexMonadScan' :: Alex LocToken alexErrorPosn :: AlexPosn -> String -> Alex a runAlexWithFilepath :: Alex a -> FilePath -> String -> Either String a lexAll :: Alex [LocToken] testLex' :: String -> Either String [LocToken] testLex :: String -> Either String [Token] alex_action_1 :: AlexAction LocToken alex_action_2 :: AlexAction LocToken alex_action_3 :: AlexAction LocToken alex_action_4 :: AlexAction LocToken alex_action_5 :: AlexAction LocToken alex_action_6 :: AlexAction LocToken alex_action_7 :: AlexAction LocToken alex_action_8 :: AlexAction LocToken alex_action_9 :: AlexAction LocToken alex_action_10 :: AlexAction LocToken alex_action_11 :: AlexAction LocToken alex_action_12 :: AlexAction LocToken alex_action_13 :: AlexAction LocToken alex_action_14 :: AlexAction LocToken alex_action_15 :: AlexAction LocToken alex_action_16 :: AlexAction LocToken alex_action_17 :: AlexAction LocToken alex_action_18 :: AlexAction LocToken alex_action_19 :: AlexAction LocToken alex_action_20 :: AlexAction LocToken alex_action_21 :: AlexAction LocToken alex_action_22 :: AlexAction LocToken alex_action_23 :: AlexAction LocToken alex_action_24 :: AlexAction LocToken alex_action_25 :: AlexAction LocToken alex_action_26 :: AlexAction LocToken alex_action_27 :: AlexAction LocToken alex_action_28 :: AlexAction LocToken alex_action_29 :: AlexAction LocToken alex_action_30 :: AlexAction LocToken alex_action_31 :: AlexAction LocToken alex_action_32 :: AlexAction LocToken alex_action_33 :: AlexAction LocToken alex_action_34 :: AlexAction LocToken alex_action_35 :: AlexAction LocToken alex_action_36 :: AlexAction LocToken alex_action_37 :: AlexAction LocToken alex_action_38 :: AlexAction LocToken alex_action_39 :: AlexAction LocToken alex_action_40 :: AlexAction LocToken alex_action_41 :: AlexAction LocToken alex_action_42 :: AlexAction LocToken alex_action_43 :: AlexAction LocToken alex_action_44 :: AlexAction LocToken alex_action_45 :: AlexAction LocToken alex_action_46 :: AlexAction LocToken alex_action_47 :: AlexAction LocToken alex_action_48 :: AlexAction LocToken alex_action_49 :: AlexAction LocToken alex_action_50 :: AlexAction LocToken alex_action_51 :: AlexAction LocToken alex_action_52 :: AlexAction LocToken alex_action_53 :: AlexAction LocToken alex_action_54 :: AlexAction LocToken alex_action_55 :: AlexAction LocToken alex_action_56 :: AlexAction LocToken alex_action_57 :: AlexAction LocToken alex_action_58 :: AlexAction LocToken alex_action_59 :: AlexAction LocToken alex_action_60 :: AlexAction LocToken alex_action_61 :: AlexAction LocToken alex_action_62 :: AlexAction LocToken alex_action_63 :: AlexAction LocToken alex_action_64 :: AlexAction LocToken alex_action_65 :: AlexAction LocToken alex_action_66 :: AlexAction LocToken alex_action_67 :: AlexAction LocToken alex_action_68 :: AlexAction LocToken alex_action_69 :: AlexAction LocToken alex_action_70 :: AlexAction LocToken alex_action_71 :: AlexAction LocToken alex_action_72 :: AlexAction LocToken alex_action_73 :: AlexAction LocToken alex_action_74 :: AlexAction LocToken alex_action_75 :: AlexAction LocToken alex_action_76 :: AlexAction LocToken alex_action_77 :: AlexAction LocToken alex_action_78 :: AlexAction LocToken alex_action_79 :: AlexAction LocToken alex_action_80 :: AlexAction LocToken alex_action_81 :: AlexAction LocToken alex_action_82 :: AlexAction LocToken alex_action_83 :: AlexAction LocToken alex_action_84 :: AlexAction LocToken alex_action_85 :: AlexAction LocToken alex_action_86 :: AlexAction LocToken alex_action_87 :: AlexAction LocToken alex_action_88 :: AlexAction LocToken alex_action_89 :: AlexAction LocToken alex_action_90 :: AlexAction LocToken alex_action_91 :: AlexAction LocToken alex_action_92 :: AlexAction LocToken alex_action_93 :: AlexAction LocToken alex_action_94 :: AlexAction LocToken alex_action_95 :: AlexAction LocToken alex_action_96 :: AlexAction LocToken alex_action_97 :: AlexAction LocToken alex_action_98 :: AlexAction LocToken alex_action_99 :: AlexAction LocToken alex_action_100 :: AlexAction LocToken alex_action_101 :: AlexAction LocToken data AlexAddr AlexA# :: Addr# -> AlexAddr alexIndexInt16OffAddr :: AlexAddr -> Int# -> Int# -- | Encode a Haskell String to a list of Word8 values, in UTF8 format. utf8Encode :: Char -> [Word8] type Byte = Word8 type AlexInput = (AlexPosn, Char, [Byte], String) ignorePendingBytes :: AlexInput -> AlexInput alexInputPrevChar :: AlexInput -> Char alexGetByte :: AlexInput -> Maybe (Byte, AlexInput) data AlexPosn AlexPn :: !Int -> !Int -> !Int -> AlexPosn alexStartPos :: AlexPosn alexMove :: AlexPosn -> Char -> AlexPosn data AlexState AlexState :: !AlexPosn -> String -> !Char -> [Byte] -> !Int -> AlexUserState -> AlexState [alex_pos] :: AlexState -> !AlexPosn [alex_inp] :: AlexState -> String [alex_chr] :: AlexState -> !Char [alex_bytes] :: AlexState -> [Byte] [alex_scd] :: AlexState -> !Int [alex_ust] :: AlexState -> AlexUserState runAlex :: String -> Alex a -> Either String a newtype Alex a Alex :: (AlexState -> Either String (AlexState, a)) -> Alex a [unAlex] :: Alex a -> AlexState -> Either String (AlexState, a) alexGetInput :: Alex AlexInput alexSetInput :: AlexInput -> Alex () alexError :: String -> Alex a alexGetStartCode :: Alex Int alexSetStartCode :: Int -> Alex () alexGetUserState :: Alex AlexUserState alexSetUserState :: AlexUserState -> Alex () alexMonadScan :: Alex LocToken type AlexAction result = AlexInput -> Int -> Alex result skip :: p1 -> p2 -> Alex LocToken begin :: Int -> p1 -> p2 -> Alex LocToken andBegin :: AlexAction result -> Int -> AlexAction result token :: (AlexInput -> Int -> token) -> AlexAction token alex_tab_size :: Int alex_base :: AlexAddr alex_table :: AlexAddr alex_check :: AlexAddr alex_deflt :: AlexAddr alex_accept :: Array Int (AlexAcc user) alex_actions :: Array Int (AlexAction LocToken) instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Lex.AlexPosn instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Lex.AlexPosn instance GHC.Classes.Ord Preql.QuasiQuoter.Syntax.Lex.Token instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Lex.Token instance GHC.Read.Read Preql.QuasiQuoter.Syntax.Lex.Token instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Lex.Token instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Lex.LocToken instance GHC.Base.Functor Preql.QuasiQuoter.Syntax.Lex.Alex instance GHC.Base.Applicative Preql.QuasiQuoter.Syntax.Lex.Alex instance GHC.Base.Monad Preql.QuasiQuoter.Syntax.Lex.Alex instance Control.Monad.Fail.MonadFail Preql.QuasiQuoter.Syntax.Lex.Alex -- | Definitions which need to be private in order to maintain their -- invariants. module Preql.QuasiQuoter.Syntax.Name newtype Name Name :: Text -> Name mkName :: Text -> Name getName :: Name -> Text instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Name.Name instance Data.Data.Data Preql.QuasiQuoter.Syntax.Name.Name instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Name.Name instance GHC.Classes.Ord Preql.QuasiQuoter.Syntax.Name.Name instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Name.Name instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Name.Name instance Data.String.IsString Preql.QuasiQuoter.Syntax.Name.Name module Preql.QuasiQuoter.Syntax.Syntax data Literal I :: !Word -> Literal F :: !Double -> Literal T :: !Text -> Literal B :: !Bool -> Literal Null :: Literal data Statement QI :: !Insert -> Statement QD :: !Delete -> Statement QU :: !Update -> Statement QS :: !SelectStmt -> Statement -- | Queries of the form INSERT INTO table (columns) VALUES -- (values); Limitations: * single row * no ON CONFLICT data Insert Insert :: !Name -> NonEmpty Name -> NonEmpty Expr -> Insert [$sel:table:Insert] :: Insert -> !Name [$sel:columns:Insert] :: Insert -> NonEmpty Name [$sel:values:Insert] :: Insert -> NonEmpty Expr -- | Queries of the form DELETE FROM table WHERE conditions. data Delete Delete :: !Name -> Maybe Expr -> Delete [$sel:table:Delete] :: Delete -> !Name [$sel:conditions:Delete] :: Delete -> Maybe Expr data Setting Setting :: !Name -> !Expr -> Setting -- | Queries of the form UPDATE table SET settings WHERE -- conditions. Where each Setting name literal is like SQL -- name = literal. data Update Update :: !Name -> NonEmpty Setting -> Maybe Expr -> Update [$sel:table:Update] :: Update -> !Name [$sel:settings:Update] :: Update -> NonEmpty Setting [$sel:conditions:Update] :: Update -> Maybe Expr data SelectStmt SelectValues :: NonEmpty (NonEmpty Expr) -> SelectStmt Simple :: Select -> SelectStmt S :: SelectStmt -> SelectOptions -> SelectStmt Set :: SetOp -> AllOrDistinct -> SelectStmt -> SelectStmt -> SelectStmt data Select Select :: Maybe DistinctClause -> [ResTarget] -> [TableRef] -> Maybe Expr -> [Expr] -> Maybe Expr -> [WindowDef] -> Select [$sel:distinct:Select] :: Select -> Maybe DistinctClause [$sel:targetList:Select] :: Select -> [ResTarget] [$sel:from:Select] :: Select -> [TableRef] [$sel:whereClause:Select] :: Select -> Maybe Expr [$sel:groupBy:Select] :: Select -> [Expr] [$sel:having:Select] :: Select -> Maybe Expr [$sel:window:Select] :: Select -> [WindowDef] data SelectOptions SelectOptions :: [SortBy] -> Maybe Expr -> Maybe Expr -> [Locking] -> Maybe WithClause -> SelectOptions [$sel:sortBy:SelectOptions] :: SelectOptions -> [SortBy] [$sel:offset:SelectOptions] :: SelectOptions -> Maybe Expr [$sel:limit:SelectOptions] :: SelectOptions -> Maybe Expr [$sel:locking:SelectOptions] :: SelectOptions -> [Locking] [$sel:withClause:SelectOptions] :: SelectOptions -> Maybe WithClause select :: Select selectOptions :: SelectOptions data TableRef J :: JoinedTable -> TableRef As :: JoinedTable -> Alias -> TableRef SubSelect :: SelectStmt -> Alias -> TableRef data JoinedTable Table :: Name -> JoinedTable Join :: JoinType -> JoinQual -> TableRef -> TableRef -> JoinedTable CrossJoin :: TableRef -> TableRef -> JoinedTable data Alias Alias :: Name -> [Name] -> Alias [$sel:aliasName:Alias] :: Alias -> Name [$sel:columnNames:Alias] :: Alias -> [Name] data JoinType Inner :: JoinType LeftJoin :: JoinType RightJoin :: JoinType Full :: JoinType data JoinQual Using :: [Name] -> JoinQual On :: Expr -> JoinQual Natural :: JoinQual data DistinctClause DistinctAll :: DistinctClause DistinctOn :: NonEmpty Expr -> DistinctClause data SetOp Union :: SetOp Intersect :: SetOp Except :: SetOp data AllOrDistinct All :: AllOrDistinct Distinct :: AllOrDistinct data ResTarget Star :: ResTarget Column :: Expr -> Maybe Name -> ResTarget data WindowDef WindowDef :: Name -> WindowSpec -> WindowDef data Over WindowName :: Name -> Over Window :: WindowSpec -> Over data WindowSpec WindowSpec :: Maybe Name -> [Expr] -> [SortBy] -> WindowSpec [$sel:refName:WindowSpec] :: WindowSpec -> Maybe Name [$sel:partitionClause:WindowSpec] :: WindowSpec -> [Expr] [$sel:orderClause:WindowSpec] :: WindowSpec -> [SortBy] noWindow :: Over data SortBy SortBy :: Expr -> SortOrderOrUsing -> NullsOrder -> SortBy [$sel:column:SortBy] :: SortBy -> Expr [$sel:direction:SortBy] :: SortBy -> SortOrderOrUsing [$sel:nulls:SortBy] :: SortBy -> NullsOrder data SortOrderOrUsing SortOrder :: SortOrder -> SortOrderOrUsing SortUsing :: BinOp -> SortOrderOrUsing data SortOrder Ascending :: SortOrder Descending :: SortOrder DefaultSortOrder :: SortOrder data NullsOrder NullsFirst :: NullsOrder NullsLast :: NullsOrder NullsOrderDefault :: NullsOrder data Locking Locking :: LockingStrength -> [Name] -> LockWait -> Locking [$sel:strength:Locking] :: Locking -> LockingStrength [$sel:tables:Locking] :: Locking -> [Name] [$sel:wait:Locking] :: Locking -> LockWait data LockingStrength ForUpdate :: LockingStrength ForNoKeyUpdate :: LockingStrength ForShare :: LockingStrength ForKeyShare :: LockingStrength data LockWait LockWaitError :: LockWait LockWaitSkip :: LockWait LockWaitBlock :: LockWait data WithClause With :: [CTE] -> Recursive -> WithClause [$sel:commonTables:With] :: WithClause -> [CTE] [$sel:recursive:With] :: WithClause -> Recursive data Recursive Recursive :: Recursive NotRecursive :: Recursive data Materialized Materialized :: Materialized NotMaterialized :: Materialized MaterializeDefault :: Materialized data CTE CommonTableExpr :: Name -> [Name] -> Materialized -> Statement -> CTE [$sel:name:CommonTableExpr] :: CTE -> Name [$sel:aliases:CommonTableExpr] :: CTE -> [Name] [$sel:materialized:CommonTableExpr] :: CTE -> Materialized [$sel:query:CommonTableExpr] :: CTE -> Statement data Expr Lit :: !Literal -> Expr CRef :: Name -> Expr NumberedParam :: !Word -> Expr HaskellParam :: !Text -> Expr BinOp :: !BinOp -> !Expr -> !Expr -> Expr Unary :: !UnaryOp -> !Expr -> Expr Indirection :: Expr -> NonEmpty Indirection -> Expr SelectExpr :: SelectStmt -> Expr L :: LikeE -> Expr Fun :: FunctionApplication -> Expr Cas :: Case -> Expr type Indirection = Name data BinOp Mul :: BinOp Div :: BinOp Add :: BinOp Sub :: BinOp Exponent :: BinOp Mod :: BinOp Eq :: BinOp LT :: BinOp LTE :: BinOp GT :: BinOp GTE :: BinOp NEq :: BinOp IsDistinctFrom :: BinOp IsNotDistinctFrom :: BinOp And :: BinOp Or :: BinOp data UnaryOp Negate :: UnaryOp Not :: UnaryOp IsNull :: UnaryOp NotNull :: UnaryOp data LikeOp Like :: LikeOp ILike :: LikeOp Similar :: LikeOp data LikeE LikeE :: LikeOp -> Expr -> Expr -> Maybe Expr -> Bool -> LikeE [$sel:op:LikeE] :: LikeE -> LikeOp [$sel:string:LikeE] :: LikeE -> Expr [$sel:likePattern:LikeE] :: LikeE -> Expr [$sel:escape:LikeE] :: LikeE -> Maybe Expr [$sel:invert:LikeE] :: LikeE -> Bool like :: LikeOp -> Expr -> Expr -> LikeE data FunctionApplication FApp :: Name -> [Indirection] -> FunctionArguments -> [SortBy] -> Maybe Expr -> Over -> FunctionApplication [$sel:name:FApp] :: FunctionApplication -> Name [$sel:indirection:FApp] :: FunctionApplication -> [Indirection] [$sel:arguments:FApp] :: FunctionApplication -> FunctionArguments [$sel:withinGroup:FApp] :: FunctionApplication -> [SortBy] [$sel:filterClause:FApp] :: FunctionApplication -> Maybe Expr [$sel:over:FApp] :: FunctionApplication -> Over fapp :: (Name, [Indirection]) -> FunctionArguments -> FunctionApplication fapp1 :: Name -> [Expr] -> FunctionApplication setSortBy :: FunctionApplication -> [SortBy] -> FunctionApplication data FunctionArguments StarArg :: FunctionArguments NoArgs :: FunctionArguments Args :: ArgsList -> FunctionArguments data ArgsList ArgsList :: NonEmpty Argument -> [SortBy] -> Bool -> ArgsList [$sel:arguments:ArgsList] :: ArgsList -> NonEmpty Argument [$sel:sortBy:ArgsList] :: ArgsList -> [SortBy] [$sel:distinct:ArgsList] :: ArgsList -> Bool argsList :: NonEmpty Argument -> ArgsList data Argument E :: Expr -> Argument Named :: Name -> Expr -> Argument data Case Case :: [(Expr, Expr)] -> Maybe Expr -> Maybe Expr -> Case [$sel:whenClause:Case] :: Case -> [(Expr, Expr)] [$sel:implicitArg:Case] :: Case -> Maybe Expr [$sel:elseClause:Case] :: Case -> Maybe Expr instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.Literal instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.Literal instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.Literal instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.Literal instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.Literal instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.Alias instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.Alias instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.Alias instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.Alias instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.Alias instance GHC.Enum.Bounded Preql.QuasiQuoter.Syntax.Syntax.JoinType instance GHC.Enum.Enum Preql.QuasiQuoter.Syntax.Syntax.JoinType instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.JoinType instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.JoinType instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.JoinType instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.JoinType instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.JoinType instance GHC.Enum.Bounded Preql.QuasiQuoter.Syntax.Syntax.SetOp instance GHC.Enum.Enum Preql.QuasiQuoter.Syntax.Syntax.SetOp instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.SetOp instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.SetOp instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.SetOp instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.SetOp instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.SetOp instance GHC.Enum.Bounded Preql.QuasiQuoter.Syntax.Syntax.AllOrDistinct instance GHC.Enum.Enum Preql.QuasiQuoter.Syntax.Syntax.AllOrDistinct instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.AllOrDistinct instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.AllOrDistinct instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.AllOrDistinct instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.AllOrDistinct instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.AllOrDistinct instance GHC.Enum.Bounded Preql.QuasiQuoter.Syntax.Syntax.SortOrder instance GHC.Enum.Enum Preql.QuasiQuoter.Syntax.Syntax.SortOrder instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.SortOrder instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.SortOrder instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.SortOrder instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.SortOrder instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.SortOrder instance GHC.Enum.Bounded Preql.QuasiQuoter.Syntax.Syntax.NullsOrder instance GHC.Enum.Enum Preql.QuasiQuoter.Syntax.Syntax.NullsOrder instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.NullsOrder instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.NullsOrder instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.NullsOrder instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.NullsOrder instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.NullsOrder instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.LockingStrength instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.LockingStrength instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.LockingStrength instance GHC.Enum.Bounded Preql.QuasiQuoter.Syntax.Syntax.LockingStrength instance GHC.Enum.Enum Preql.QuasiQuoter.Syntax.Syntax.LockingStrength instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.LockingStrength instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.LockingStrength instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.LockWait instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.LockWait instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.LockWait instance GHC.Enum.Bounded Preql.QuasiQuoter.Syntax.Syntax.LockWait instance GHC.Enum.Enum Preql.QuasiQuoter.Syntax.Syntax.LockWait instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.LockWait instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.LockWait instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.Locking instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.Locking instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.Locking instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.Locking instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.Locking instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.Recursive instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.Recursive instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.Recursive instance GHC.Enum.Bounded Preql.QuasiQuoter.Syntax.Syntax.Recursive instance GHC.Enum.Enum Preql.QuasiQuoter.Syntax.Syntax.Recursive instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.Recursive instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.Recursive instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.Materialized instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.Materialized instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.Materialized instance GHC.Enum.Bounded Preql.QuasiQuoter.Syntax.Syntax.Materialized instance GHC.Enum.Enum Preql.QuasiQuoter.Syntax.Syntax.Materialized instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.Materialized instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.Materialized instance GHC.Enum.Enum Preql.QuasiQuoter.Syntax.Syntax.BinOp instance GHC.Enum.Bounded Preql.QuasiQuoter.Syntax.Syntax.BinOp instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.BinOp instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.BinOp instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.BinOp instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.BinOp instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.BinOp instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.SortOrderOrUsing instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.SortOrderOrUsing instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.SortOrderOrUsing instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.SortOrderOrUsing instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.SortOrderOrUsing instance GHC.Enum.Enum Preql.QuasiQuoter.Syntax.Syntax.UnaryOp instance GHC.Enum.Bounded Preql.QuasiQuoter.Syntax.Syntax.UnaryOp instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.UnaryOp instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.UnaryOp instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.UnaryOp instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.UnaryOp instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.UnaryOp instance GHC.Enum.Enum Preql.QuasiQuoter.Syntax.Syntax.LikeOp instance GHC.Enum.Bounded Preql.QuasiQuoter.Syntax.Syntax.LikeOp instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.LikeOp instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.LikeOp instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.LikeOp instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.LikeOp instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.LikeOp instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.JoinQual instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.JoinQual instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.JoinQual instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.JoinQual instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.JoinQual instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.JoinedTable instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.JoinedTable instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.JoinedTable instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.JoinedTable instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.JoinedTable instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.TableRef instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.TableRef instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.TableRef instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.TableRef instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.TableRef instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.DistinctClause instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.DistinctClause instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.DistinctClause instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.DistinctClause instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.DistinctClause instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.ResTarget instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.ResTarget instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.ResTarget instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.ResTarget instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.ResTarget instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.WindowDef instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.WindowDef instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.WindowDef instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.WindowDef instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.WindowDef instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.Select instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.Select instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.Select instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.Select instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.Select instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.Insert instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.Insert instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.Insert instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.Insert instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.Insert instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.Delete instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.Delete instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.Delete instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.Delete instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.Delete instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.Setting instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.Setting instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.Setting instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.Setting instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.Setting instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.Update instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.Update instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.Update instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.Update instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.Update instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.Statement instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.Statement instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.Statement instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.Statement instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.Statement instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.CTE instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.CTE instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.CTE instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.CTE instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.CTE instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.WithClause instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.WithClause instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.WithClause instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.WithClause instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.WithClause instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.SelectOptions instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.SelectOptions instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.SelectOptions instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.SelectOptions instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.SelectOptions instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.SelectStmt instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.SelectStmt instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.SelectStmt instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.SelectStmt instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.SelectStmt instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.LikeE instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.LikeE instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.LikeE instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.LikeE instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.LikeE instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.WindowSpec instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.WindowSpec instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.WindowSpec instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.WindowSpec instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.WindowSpec instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.Over instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.Over instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.Over instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.Over instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.Over instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.SortBy instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.SortBy instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.SortBy instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.SortBy instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.SortBy instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.Argument instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.Argument instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.Argument instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.Argument instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.Argument instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.ArgsList instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.ArgsList instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.ArgsList instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.ArgsList instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.ArgsList instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.FunctionArguments instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.FunctionArguments instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.FunctionArguments instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.FunctionArguments instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.FunctionArguments instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.FunctionApplication instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.FunctionApplication instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.FunctionApplication instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.FunctionApplication instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.FunctionApplication instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.Expr instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.Expr instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.Expr instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.Expr instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.Expr instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Syntax.Case instance Data.Data.Data Preql.QuasiQuoter.Syntax.Syntax.Case instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Syntax.Case instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Syntax.Case instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Syntax.Case -- | Print the types in Syntax as valid SQL. The emphasis is on queries to -- send to the database, not on legibilty; no extra whitespace is -- introduced. module Preql.QuasiQuoter.Syntax.Printer quote :: Builder -> Builder doubleQuote :: Builder -> Builder parens :: Builder -> Builder parensIf :: Bool -> Builder -> Builder spaceAfter :: Builder -> Builder class FormatSql a fmt :: FormatSql a => a -> Builder fmtPrec :: FormatSql a => Int -> a -> Builder formatAsString :: FormatSql a => a -> String formatAsByteString :: FormatSql a => a -> ByteString formatAsText :: FormatSql a => a -> Text commas :: (FormatSql a, Foldable f) => f a -> Builder spaces :: (FormatSql a, Foldable f) => f a -> Builder fmtList :: (FormatSql a, Foldable f) => Builder -> f a -> Builder unlessEmpty :: (Builder -> Builder) -> Builder -> Builder optList :: FormatSql a => Builder -> [a] -> Builder opt :: FormatSql a => Builder -> Maybe a -> Builder opt' :: FormatSql a => Builder -> Int -> Maybe a -> Builder fmtIndirections :: Foldable f => f Indirection -> Builder data Assoc LeftAssoc :: Assoc RightAssoc :: Assoc NonAssoc :: Assoc binOpPrec :: BinOp -> (Assoc, Int) setOpPrec :: SetOp -> Int instance GHC.Generics.Generic Preql.QuasiQuoter.Syntax.Printer.Assoc instance Language.Haskell.TH.Syntax.Lift Preql.QuasiQuoter.Syntax.Printer.Assoc instance Data.Data.Data Preql.QuasiQuoter.Syntax.Printer.Assoc instance GHC.Enum.Bounded Preql.QuasiQuoter.Syntax.Printer.Assoc instance GHC.Enum.Enum Preql.QuasiQuoter.Syntax.Printer.Assoc instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Printer.Assoc instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Printer.Assoc instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.Expr instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Name.Name instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.Literal instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.Statement instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Data.Text.Internal.Builder.Builder instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.Insert instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.Delete instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.Setting instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.Update instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.BinOp instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.LikeE instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.SelectStmt instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.Select instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.SelectOptions instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.WithClause instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.Materialized instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.CTE instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.TableRef instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.Alias instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.JoinedTable instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.JoinType instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.DistinctClause instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.SortBy instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.SortOrderOrUsing instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.SortOrder instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.NullsOrder instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.Locking instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.LockingStrength instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.LockWait instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.SetOp instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.ResTarget instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.WindowDef instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.WindowSpec instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.FunctionApplication instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.FunctionArguments instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.Argument instance Preql.QuasiQuoter.Syntax.Printer.FormatSql Preql.QuasiQuoter.Syntax.Syntax.Case module Preql.QuasiQuoter.Syntax.Parser parseStatement :: FilePath -> String -> Either String Statement parseSelect :: FilePath -> String -> Either String SelectStmt parseExpr :: FilePath -> String -> Either String Expr -- | Parameter substitution for the Untyped SQL AST. module Preql.QuasiQuoter.Syntax.Params numberAntiquotes :: Word -> Statement -> (Statement, AntiquoteState) numberAntiquotesExpr :: Expr -> State AntiquoteState Expr data AntiquoteState AntiquoteState :: Word -> [Text] -> AntiquoteState [paramCount] :: AntiquoteState -> Word [haskellExpressions] :: AntiquoteState -> [Text] initialAntiquoteState :: AntiquoteState -- | Return the highest-numbered $1-style parameter. maxParam :: Statement -> Word maxParamExpr :: Expr -> Word instance GHC.Classes.Ord Preql.QuasiQuoter.Syntax.Params.AntiquoteState instance GHC.Classes.Eq Preql.QuasiQuoter.Syntax.Params.AntiquoteState instance GHC.Show.Show Preql.QuasiQuoter.Syntax.Params.AntiquoteState -- | Orphan instances module Preql.Wire.Orphans instance Data.Aeson.Types.ToJSON.ToJSON Database.PostgreSQL.LibPQ.Oid instance Data.Aeson.Types.FromJSON.FromJSON Database.PostgreSQL.LibPQ.Oid -- | Errors raised by functions in Preql.Wire module Preql.Wire.Errors -- | Errors that can occur in decoding a single field. data UnlocatedFieldError UnexpectedNull :: UnlocatedFieldError ParseFailure :: Text -> UnlocatedFieldError -- | A decoding error with information about the row & column of the -- result where it occured. data FieldError FieldError :: Int -> Int -> UnlocatedFieldError -> FieldError [errorRow] :: FieldError -> Int [errorColumn] :: FieldError -> Int [failure] :: FieldError -> UnlocatedFieldError data PgType -- | A Postgres type with a known ID Oid :: Oid -> PgType -- | A Postgres type which we will need to lookup by name TypeName :: Text -> PgType data TypeMismatch TypeMismatch :: PgType -> Oid -> Int -> Maybe Text -> TypeMismatch [expected] :: TypeMismatch -> PgType [actual] :: TypeMismatch -> Oid [column] :: TypeMismatch -> Int [columnName] :: TypeMismatch -> Maybe Text data QueryError ConnectionError :: Text -> QueryError DecoderError :: FieldError -> QueryError PgTypeMismatch :: [TypeMismatch] -> QueryError instance Data.Aeson.Types.ToJSON.ToJSON Preql.Wire.Errors.QueryError instance Data.Aeson.Types.FromJSON.FromJSON Preql.Wire.Errors.QueryError instance GHC.Show.Show Preql.Wire.Errors.QueryError instance GHC.Classes.Eq Preql.Wire.Errors.QueryError instance GHC.Exception.Type.Exception Preql.Wire.Errors.QueryError instance Data.Aeson.Types.ToJSON.ToJSON Preql.Wire.Errors.TypeMismatch instance Data.Aeson.Types.FromJSON.FromJSON Preql.Wire.Errors.TypeMismatch instance GHC.Show.Show Preql.Wire.Errors.TypeMismatch instance GHC.Classes.Eq Preql.Wire.Errors.TypeMismatch instance Data.Aeson.Types.ToJSON.ToJSON Preql.Wire.Errors.PgType instance Data.Aeson.Types.FromJSON.FromJSON Preql.Wire.Errors.PgType instance GHC.Show.Show Preql.Wire.Errors.PgType instance GHC.Classes.Eq Preql.Wire.Errors.PgType instance Data.Aeson.Types.ToJSON.ToJSON Preql.Wire.Errors.FieldError instance Data.Aeson.Types.FromJSON.FromJSON Preql.Wire.Errors.FieldError instance GHC.Show.Show Preql.Wire.Errors.FieldError instance GHC.Classes.Eq Preql.Wire.Errors.FieldError instance GHC.Exception.Type.Exception Preql.Wire.Errors.FieldError instance Data.Aeson.Types.ToJSON.ToJSON Preql.Wire.Errors.UnlocatedFieldError instance Data.Aeson.Types.FromJSON.FromJSON Preql.Wire.Errors.UnlocatedFieldError instance GHC.Show.Show Preql.Wire.Errors.UnlocatedFieldError instance GHC.Classes.Eq Preql.Wire.Errors.UnlocatedFieldError -- | The types in this module have invariants which cannot be checked if -- their constructors are in scope. Preql.Wire exports the type names -- only. module Preql.Wire.Internal -- | The IsString instance does no validation; the limited instances -- discourage directly manipulating strings, with the high risk of SQL -- injection. A Query is tagged with a Nat representing -- the width of its return type. newtype Query (n :: Nat) Query :: ByteString -> Query (n :: Nat) -- | RowDecoder is Functor but not Monad so that we -- can index the type by the number of columns that it consumes. We also -- know & verify all of the OIDs before we read any of the field data -- sent by Postgres, which would admit an Applicative instance but -- not Monad data RowDecoder (n :: Nat) a RowDecoder :: Vector n PgType -> InternalDecoder a -> RowDecoder (n :: Nat) a -- | Analogous to pure, pureDecoder a returns the value -- a without consuming any input from Postgres. pureDecoder :: a -> RowDecoder 0 a -- | Analogous to <*>, pureDecoder Constructor -- applyDecoder a applyDecoder b supplies two -- arguments to Constructor, from the RowDecoder -- a and b. applyDecoder :: RowDecoder m (a -> b) -> RowDecoder n a -> RowDecoder (m + n) b -- | Internal because we need IO for the libpq FFI, but we promise not to -- do any IO besides decoding. We don't even make network calls to -- Postgres in InternalDecoder type InternalDecoder = StateT DecoderState (ExceptT FieldError IO) data DecoderState DecoderState :: Result -> Row -> Column -> DecoderState [$sel:result:DecoderState] :: DecoderState -> Result [$sel:row:DecoderState] :: DecoderState -> Row [$sel:column:DecoderState] :: DecoderState -> Column decodeRow :: RowDecoder n a -> Result -> Row -> ExceptT FieldError IO a getNextValue :: InternalDecoder (Maybe ByteString) instance Data.String.IsString (Preql.Wire.Internal.Query n) instance GHC.Show.Show (Preql.Wire.Internal.Query n) instance GHC.Classes.Eq Preql.Wire.Internal.DecoderState instance GHC.Show.Show Preql.Wire.Internal.DecoderState instance GHC.Base.Functor (Preql.Wire.Internal.RowDecoder n) module Preql.QuasiQuoter.Syntax.TH tupleType :: [Name] -> Type -- | Synthesize a Query tagged with the number of returned columns. makeArityQuery :: Statement -> Q Exp -- | This quasiquoter will accept most syntactically valid SELECT queries. -- Language features not yet implemented include type casts, lateral -- joins, EXTRACT, INTO, string & XML operators, and user-defined -- operators. For now, please fall back to sql for these -- less-frequently used SQL features, or file a bug report if a commonly -- used feature is not parsed correctly. -- -- select accepts antiquotes with the same syntax as -- sql. select :: QuasiQuoter -- | This quasiquoter will accept all queries accepted by select, -- and limited INSERT, UPDATE, and DELETE queries. For details of what -- can be parsed, consult Parser.y validSql :: QuasiQuoter aritySql :: (String -> String -> Either String a) -> (a -> Statement) -> String -> Q Exp countColumnsReturned :: Statement -> Maybe Int -- | Decoding values from Postgres wire format to Haskell. module Preql.Wire.Decode decodeVector :: KnownNat n => (PgType -> IO (Either QueryError Oid)) -> RowDecoder n a -> Result -> IO (Either QueryError (Vector a)) module Preql.FromSql.Class -- | A FieldDecoder for a type a consists of an OID -- indicating the Postgres type which can be decoded, and a parser from -- the binary representation of that type to the Haskell representation. data FieldDecoder a FieldDecoder :: PgType -> BinaryParser a -> FieldDecoder a class FromSqlField a fromSqlField :: FromSqlField a => FieldDecoder a -- | A type which can be decoded from a SQL row. Note that this includes -- the canonical order of fields. -- -- The default (empty) instance works for any type with a -- FromSqlField instance class FromSql a where { -- | The number of columns read in decoding this type. type family Width a :: Nat; type Width a = 1; } fromSql :: FromSql a => RowDecoder (Width a) a fromSql :: (FromSql a, FromSqlField a, Width a ~ 1) => RowDecoder (Width a) a -- | Construct a decoder for a single non-nullable column. notNull :: FieldDecoder a -> RowDecoder 1 a -- | Construct a decoder for a single nullable column. nullable :: FieldDecoder a -> RowDecoder 1 (Maybe a) throwLocated :: UnlocatedFieldError -> InternalDecoder a instance GHC.Base.Functor Preql.FromSql.Class.FieldDecoder -- | Construct FromSql instances module Preql.FromSql.TH deriveFromSqlTuple :: Int -> Q [Dec] deriveFromSql :: Name -> Q [Dec] tyVarName :: TyVarBndr -> Name fromSqlDecl :: [Name] -> Type -> Name -> Int -> Dec -- | Template Haskell macros to generate tuple instances for FromSql & -- ToSql module Preql.Wire.Tuples deriveToSqlTuple :: Int -> Q [Dec] module Preql.Wire.TypeInfo.Types -- | A structure representing some of the metadata regarding a PostgreSQL -- type, mostly taken from the pg_type table. data TypeInfo Basic :: {-# UNPACK #-} !Oid -> {-# UNPACK #-} !Char -> {-# UNPACK #-} !Char -> !ByteString -> TypeInfo [typoid] :: TypeInfo -> {-# UNPACK #-} !Oid [typcategory] :: TypeInfo -> {-# UNPACK #-} !Char [typdelim] :: TypeInfo -> {-# UNPACK #-} !Char [typname] :: TypeInfo -> !ByteString Array :: {-# UNPACK #-} !Oid -> {-# UNPACK #-} !Char -> {-# UNPACK #-} !Char -> !ByteString -> !TypeInfo -> TypeInfo [typoid] :: TypeInfo -> {-# UNPACK #-} !Oid [typcategory] :: TypeInfo -> {-# UNPACK #-} !Char [typdelim] :: TypeInfo -> {-# UNPACK #-} !Char [typname] :: TypeInfo -> !ByteString [typelem] :: TypeInfo -> !TypeInfo Range :: {-# UNPACK #-} !Oid -> {-# UNPACK #-} !Char -> {-# UNPACK #-} !Char -> !ByteString -> !TypeInfo -> TypeInfo [typoid] :: TypeInfo -> {-# UNPACK #-} !Oid [typcategory] :: TypeInfo -> {-# UNPACK #-} !Char [typdelim] :: TypeInfo -> {-# UNPACK #-} !Char [typname] :: TypeInfo -> !ByteString [rngsubtype] :: TypeInfo -> !TypeInfo Composite :: {-# UNPACK #-} !Oid -> {-# UNPACK #-} !Char -> {-# UNPACK #-} !Char -> !ByteString -> {-# UNPACK #-} !Oid -> !Vector Attribute -> TypeInfo [typoid] :: TypeInfo -> {-# UNPACK #-} !Oid [typcategory] :: TypeInfo -> {-# UNPACK #-} !Char [typdelim] :: TypeInfo -> {-# UNPACK #-} !Char [typname] :: TypeInfo -> !ByteString [typrelid] :: TypeInfo -> {-# UNPACK #-} !Oid [attributes] :: TypeInfo -> !Vector Attribute data Attribute Attribute :: !ByteString -> !TypeInfo -> Attribute [attname] :: Attribute -> !ByteString [atttype] :: Attribute -> !TypeInfo instance GHC.Show.Show Preql.Wire.TypeInfo.Types.TypeInfo instance GHC.Show.Show Preql.Wire.TypeInfo.Types.Attribute -- | This module contains portions of the pg_type table that are -- relevant to postgresql-simple and are believed to not change between -- PostgreSQL versions. module Preql.Wire.TypeInfo.Static -- | A structure representing some of the metadata regarding a PostgreSQL -- type, mostly taken from the pg_type table. data TypeInfo Basic :: {-# UNPACK #-} !Oid -> {-# UNPACK #-} !Char -> {-# UNPACK #-} !Char -> !ByteString -> TypeInfo [typoid] :: TypeInfo -> {-# UNPACK #-} !Oid [typcategory] :: TypeInfo -> {-# UNPACK #-} !Char [typdelim] :: TypeInfo -> {-# UNPACK #-} !Char [typname] :: TypeInfo -> !ByteString Array :: {-# UNPACK #-} !Oid -> {-# UNPACK #-} !Char -> {-# UNPACK #-} !Char -> !ByteString -> !TypeInfo -> TypeInfo [typoid] :: TypeInfo -> {-# UNPACK #-} !Oid [typcategory] :: TypeInfo -> {-# UNPACK #-} !Char [typdelim] :: TypeInfo -> {-# UNPACK #-} !Char [typname] :: TypeInfo -> !ByteString [typelem] :: TypeInfo -> !TypeInfo Range :: {-# UNPACK #-} !Oid -> {-# UNPACK #-} !Char -> {-# UNPACK #-} !Char -> !ByteString -> !TypeInfo -> TypeInfo [typoid] :: TypeInfo -> {-# UNPACK #-} !Oid [typcategory] :: TypeInfo -> {-# UNPACK #-} !Char [typdelim] :: TypeInfo -> {-# UNPACK #-} !Char [typname] :: TypeInfo -> !ByteString [rngsubtype] :: TypeInfo -> !TypeInfo Composite :: {-# UNPACK #-} !Oid -> {-# UNPACK #-} !Char -> {-# UNPACK #-} !Char -> !ByteString -> {-# UNPACK #-} !Oid -> !Vector Attribute -> TypeInfo [typoid] :: TypeInfo -> {-# UNPACK #-} !Oid [typcategory] :: TypeInfo -> {-# UNPACK #-} !Char [typdelim] :: TypeInfo -> {-# UNPACK #-} !Char [typname] :: TypeInfo -> !ByteString [typrelid] :: TypeInfo -> {-# UNPACK #-} !Oid [attributes] :: TypeInfo -> !Vector Attribute staticTypeInfo :: Oid -> Maybe TypeInfo bool :: TypeInfo boolOid :: Oid bytea :: TypeInfo byteaOid :: Oid char :: TypeInfo charOid :: Oid name :: TypeInfo nameOid :: Oid int8 :: TypeInfo int8Oid :: Oid int2 :: TypeInfo int2Oid :: Oid int4 :: TypeInfo int4Oid :: Oid regproc :: TypeInfo regprocOid :: Oid text :: TypeInfo textOid :: Oid oid :: TypeInfo oidOid :: Oid tid :: TypeInfo tidOid :: Oid xid :: TypeInfo xidOid :: Oid cid :: TypeInfo cidOid :: Oid xml :: TypeInfo xmlOid :: Oid point :: TypeInfo pointOid :: Oid lseg :: TypeInfo lsegOid :: Oid path :: TypeInfo pathOid :: Oid box :: TypeInfo boxOid :: Oid polygon :: TypeInfo polygonOid :: Oid line :: TypeInfo lineOid :: Oid cidr :: TypeInfo cidrOid :: Oid float4 :: TypeInfo float4Oid :: Oid float8 :: TypeInfo float8Oid :: Oid unknown :: TypeInfo unknownOid :: Oid circle :: TypeInfo circleOid :: Oid money :: TypeInfo moneyOid :: Oid macaddr :: TypeInfo macaddrOid :: Oid inet :: TypeInfo inetOid :: Oid bpchar :: TypeInfo bpcharOid :: Oid varchar :: TypeInfo varcharOid :: Oid date :: TypeInfo dateOid :: Oid time :: TypeInfo timeOid :: Oid timestamp :: TypeInfo timestampOid :: Oid timestamptz :: TypeInfo timestamptzOid :: Oid interval :: TypeInfo intervalOid :: Oid timetz :: TypeInfo timetzOid :: Oid bit :: TypeInfo bitOid :: Oid varbit :: TypeInfo varbitOid :: Oid numeric :: TypeInfo numericOid :: Oid refcursor :: TypeInfo refcursorOid :: Oid record :: TypeInfo recordOid :: Oid void :: TypeInfo voidOid :: Oid array_record :: TypeInfo array_recordOid :: Oid regprocedure :: TypeInfo regprocedureOid :: Oid regoper :: TypeInfo regoperOid :: Oid regoperator :: TypeInfo regoperatorOid :: Oid regclass :: TypeInfo regclassOid :: Oid regtype :: TypeInfo regtypeOid :: Oid uuid :: TypeInfo uuidOid :: Oid json :: TypeInfo jsonOid :: Oid jsonb :: TypeInfo jsonbOid :: Oid int2vector :: TypeInfo int2vectorOid :: Oid oidvector :: TypeInfo oidvectorOid :: Oid array_xml :: TypeInfo array_xmlOid :: Oid array_json :: TypeInfo array_jsonOid :: Oid array_line :: TypeInfo array_lineOid :: Oid array_cidr :: TypeInfo array_cidrOid :: Oid array_circle :: TypeInfo array_circleOid :: Oid array_money :: TypeInfo array_moneyOid :: Oid array_bool :: TypeInfo array_boolOid :: Oid array_bytea :: TypeInfo array_byteaOid :: Oid array_char :: TypeInfo array_charOid :: Oid array_name :: TypeInfo array_nameOid :: Oid array_int2 :: TypeInfo array_int2Oid :: Oid array_int2vector :: TypeInfo array_int2vectorOid :: Oid array_int4 :: TypeInfo array_int4Oid :: Oid array_regproc :: TypeInfo array_regprocOid :: Oid array_text :: TypeInfo array_textOid :: Oid array_tid :: TypeInfo array_tidOid :: Oid array_xid :: TypeInfo array_xidOid :: Oid array_cid :: TypeInfo array_cidOid :: Oid array_oidvector :: TypeInfo array_oidvectorOid :: Oid array_bpchar :: TypeInfo array_bpcharOid :: Oid array_varchar :: TypeInfo array_varcharOid :: Oid array_int8 :: TypeInfo array_int8Oid :: Oid array_point :: TypeInfo array_pointOid :: Oid array_lseg :: TypeInfo array_lsegOid :: Oid array_path :: TypeInfo array_pathOid :: Oid array_box :: TypeInfo array_boxOid :: Oid array_float4 :: TypeInfo array_float4Oid :: Oid array_float8 :: TypeInfo array_float8Oid :: Oid array_polygon :: TypeInfo array_polygonOid :: Oid array_oid :: TypeInfo array_oidOid :: Oid array_macaddr :: TypeInfo array_macaddrOid :: Oid array_inet :: TypeInfo array_inetOid :: Oid array_timestamp :: TypeInfo array_timestampOid :: Oid array_date :: TypeInfo array_dateOid :: Oid array_time :: TypeInfo array_timeOid :: Oid array_timestamptz :: TypeInfo array_timestamptzOid :: Oid array_interval :: TypeInfo array_intervalOid :: Oid array_numeric :: TypeInfo array_numericOid :: Oid array_timetz :: TypeInfo array_timetzOid :: Oid array_bit :: TypeInfo array_bitOid :: Oid array_varbit :: TypeInfo array_varbitOid :: Oid array_refcursor :: TypeInfo array_refcursorOid :: Oid array_regprocedure :: TypeInfo array_regprocedureOid :: Oid array_regoper :: TypeInfo array_regoperOid :: Oid array_regoperator :: TypeInfo array_regoperatorOid :: Oid array_regclass :: TypeInfo array_regclassOid :: Oid array_regtype :: TypeInfo array_regtypeOid :: Oid array_uuid :: TypeInfo array_uuidOid :: Oid array_jsonb :: TypeInfo array_jsonbOid :: Oid int4range :: TypeInfo int4rangeOid :: Oid _int4range :: TypeInfo _int4rangeOid :: Oid numrange :: TypeInfo numrangeOid :: Oid _numrange :: TypeInfo _numrangeOid :: Oid tsrange :: TypeInfo tsrangeOid :: Oid _tsrange :: TypeInfo _tsrangeOid :: Oid tstzrange :: TypeInfo tstzrangeOid :: Oid _tstzrange :: TypeInfo _tstzrangeOid :: Oid daterange :: TypeInfo daterangeOid :: Oid _daterange :: TypeInfo _daterangeOid :: Oid int8range :: TypeInfo int8rangeOid :: Oid _int8range :: TypeInfo _int8rangeOid :: Oid module Preql.Wire.Types data TimeTZ TimeTZ :: !TimeOfDay -> !TimeZone -> TimeTZ instance GHC.Classes.Eq Preql.Wire.Types.TimeTZ instance GHC.Show.Show Preql.Wire.Types.TimeTZ module Preql.Wire.ToSql -- | A FieldEncoder for a type a consists of a function -- from a to it's binary representation, and an Postgres OID -- which tells Postgres it's type & how to decode it. data FieldEncoder a FieldEncoder :: Oid -> (a -> Builder) -> FieldEncoder a runFieldEncoder :: FieldEncoder p -> p -> (Oid, ByteString) type RowEncoder a = a -> [(Oid, ByteString)] runEncoder :: RowEncoder p -> p -> [Maybe (Oid, ByteString, Format)] oneField :: FieldEncoder a -> RowEncoder a -- | Types which can be encoded to a single Postgres field. class ToSqlField a toSqlField :: ToSqlField a => FieldEncoder a -- | ToSql a is sufficient to pass a as parameters to a -- paramaterized query. class ToSql a toSql :: ToSql a => RowEncoder a toSqlJsonField :: ToJSON a => FieldEncoder a instance (Preql.Wire.ToSql.ToSqlField a, Preql.Wire.ToSql.ToSqlField b, Preql.Wire.ToSql.ToSqlField c, Preql.Wire.ToSql.ToSqlField d, Preql.Wire.ToSql.ToSqlField e, Preql.Wire.ToSql.ToSqlField f, Preql.Wire.ToSql.ToSqlField g, Preql.Wire.ToSql.ToSqlField h, Preql.Wire.ToSql.ToSqlField i, Preql.Wire.ToSql.ToSqlField j, Preql.Wire.ToSql.ToSqlField k, Preql.Wire.ToSql.ToSqlField l, Preql.Wire.ToSql.ToSqlField m, Preql.Wire.ToSql.ToSqlField n, Preql.Wire.ToSql.ToSqlField o, Preql.Wire.ToSql.ToSqlField p, Preql.Wire.ToSql.ToSqlField q, Preql.Wire.ToSql.ToSqlField r, Preql.Wire.ToSql.ToSqlField s, Preql.Wire.ToSql.ToSqlField t, Preql.Wire.ToSql.ToSqlField u, Preql.Wire.ToSql.ToSqlField v, Preql.Wire.ToSql.ToSqlField w, Preql.Wire.ToSql.ToSqlField x, Preql.Wire.ToSql.ToSqlField y) => Preql.Wire.ToSql.ToSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) instance (Preql.Wire.ToSql.ToSqlField a, Preql.Wire.ToSql.ToSqlField b, Preql.Wire.ToSql.ToSqlField c, Preql.Wire.ToSql.ToSqlField d, Preql.Wire.ToSql.ToSqlField e, Preql.Wire.ToSql.ToSqlField f, Preql.Wire.ToSql.ToSqlField g, Preql.Wire.ToSql.ToSqlField h, Preql.Wire.ToSql.ToSqlField i, Preql.Wire.ToSql.ToSqlField j, Preql.Wire.ToSql.ToSqlField k, Preql.Wire.ToSql.ToSqlField l, Preql.Wire.ToSql.ToSqlField m, Preql.Wire.ToSql.ToSqlField n, Preql.Wire.ToSql.ToSqlField o, Preql.Wire.ToSql.ToSqlField p, Preql.Wire.ToSql.ToSqlField q, Preql.Wire.ToSql.ToSqlField r, Preql.Wire.ToSql.ToSqlField s, Preql.Wire.ToSql.ToSqlField t, Preql.Wire.ToSql.ToSqlField u, Preql.Wire.ToSql.ToSqlField v, Preql.Wire.ToSql.ToSqlField w, Preql.Wire.ToSql.ToSqlField x) => Preql.Wire.ToSql.ToSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) instance (Preql.Wire.ToSql.ToSqlField a, Preql.Wire.ToSql.ToSqlField b, Preql.Wire.ToSql.ToSqlField c, Preql.Wire.ToSql.ToSqlField d, Preql.Wire.ToSql.ToSqlField e, Preql.Wire.ToSql.ToSqlField f, Preql.Wire.ToSql.ToSqlField g, Preql.Wire.ToSql.ToSqlField h, Preql.Wire.ToSql.ToSqlField i, Preql.Wire.ToSql.ToSqlField j, Preql.Wire.ToSql.ToSqlField k, Preql.Wire.ToSql.ToSqlField l, Preql.Wire.ToSql.ToSqlField m, Preql.Wire.ToSql.ToSqlField n, Preql.Wire.ToSql.ToSqlField o, Preql.Wire.ToSql.ToSqlField p, Preql.Wire.ToSql.ToSqlField q, Preql.Wire.ToSql.ToSqlField r, Preql.Wire.ToSql.ToSqlField s, Preql.Wire.ToSql.ToSqlField t, Preql.Wire.ToSql.ToSqlField u, Preql.Wire.ToSql.ToSqlField v, Preql.Wire.ToSql.ToSqlField w) => Preql.Wire.ToSql.ToSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) instance (Preql.Wire.ToSql.ToSqlField a, Preql.Wire.ToSql.ToSqlField b, Preql.Wire.ToSql.ToSqlField c, Preql.Wire.ToSql.ToSqlField d, Preql.Wire.ToSql.ToSqlField e, Preql.Wire.ToSql.ToSqlField f, Preql.Wire.ToSql.ToSqlField g, Preql.Wire.ToSql.ToSqlField h, Preql.Wire.ToSql.ToSqlField i, Preql.Wire.ToSql.ToSqlField j, Preql.Wire.ToSql.ToSqlField k, Preql.Wire.ToSql.ToSqlField l, Preql.Wire.ToSql.ToSqlField m, Preql.Wire.ToSql.ToSqlField n, Preql.Wire.ToSql.ToSqlField o, Preql.Wire.ToSql.ToSqlField p, Preql.Wire.ToSql.ToSqlField q, Preql.Wire.ToSql.ToSqlField r, Preql.Wire.ToSql.ToSqlField s, Preql.Wire.ToSql.ToSqlField t, Preql.Wire.ToSql.ToSqlField u, Preql.Wire.ToSql.ToSqlField v) => Preql.Wire.ToSql.ToSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) instance (Preql.Wire.ToSql.ToSqlField a, Preql.Wire.ToSql.ToSqlField b, Preql.Wire.ToSql.ToSqlField c, Preql.Wire.ToSql.ToSqlField d, Preql.Wire.ToSql.ToSqlField e, Preql.Wire.ToSql.ToSqlField f, Preql.Wire.ToSql.ToSqlField g, Preql.Wire.ToSql.ToSqlField h, Preql.Wire.ToSql.ToSqlField i, Preql.Wire.ToSql.ToSqlField j, Preql.Wire.ToSql.ToSqlField k, Preql.Wire.ToSql.ToSqlField l, Preql.Wire.ToSql.ToSqlField m, Preql.Wire.ToSql.ToSqlField n, Preql.Wire.ToSql.ToSqlField o, Preql.Wire.ToSql.ToSqlField p, Preql.Wire.ToSql.ToSqlField q, Preql.Wire.ToSql.ToSqlField r, Preql.Wire.ToSql.ToSqlField s, Preql.Wire.ToSql.ToSqlField t, Preql.Wire.ToSql.ToSqlField u) => Preql.Wire.ToSql.ToSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) instance (Preql.Wire.ToSql.ToSqlField a, Preql.Wire.ToSql.ToSqlField b, Preql.Wire.ToSql.ToSqlField c, Preql.Wire.ToSql.ToSqlField d, Preql.Wire.ToSql.ToSqlField e, Preql.Wire.ToSql.ToSqlField f, Preql.Wire.ToSql.ToSqlField g, Preql.Wire.ToSql.ToSqlField h, Preql.Wire.ToSql.ToSqlField i, Preql.Wire.ToSql.ToSqlField j, Preql.Wire.ToSql.ToSqlField k, Preql.Wire.ToSql.ToSqlField l, Preql.Wire.ToSql.ToSqlField m, Preql.Wire.ToSql.ToSqlField n, Preql.Wire.ToSql.ToSqlField o, Preql.Wire.ToSql.ToSqlField p, Preql.Wire.ToSql.ToSqlField q, Preql.Wire.ToSql.ToSqlField r, Preql.Wire.ToSql.ToSqlField s, Preql.Wire.ToSql.ToSqlField t) => Preql.Wire.ToSql.ToSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) instance (Preql.Wire.ToSql.ToSqlField a, Preql.Wire.ToSql.ToSqlField b, Preql.Wire.ToSql.ToSqlField c, Preql.Wire.ToSql.ToSqlField d, Preql.Wire.ToSql.ToSqlField e, Preql.Wire.ToSql.ToSqlField f, Preql.Wire.ToSql.ToSqlField g, Preql.Wire.ToSql.ToSqlField h, Preql.Wire.ToSql.ToSqlField i, Preql.Wire.ToSql.ToSqlField j, Preql.Wire.ToSql.ToSqlField k, Preql.Wire.ToSql.ToSqlField l, Preql.Wire.ToSql.ToSqlField m, Preql.Wire.ToSql.ToSqlField n, Preql.Wire.ToSql.ToSqlField o, Preql.Wire.ToSql.ToSqlField p, Preql.Wire.ToSql.ToSqlField q, Preql.Wire.ToSql.ToSqlField r, Preql.Wire.ToSql.ToSqlField s) => Preql.Wire.ToSql.ToSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) instance (Preql.Wire.ToSql.ToSqlField a, Preql.Wire.ToSql.ToSqlField b, Preql.Wire.ToSql.ToSqlField c, Preql.Wire.ToSql.ToSqlField d, Preql.Wire.ToSql.ToSqlField e, Preql.Wire.ToSql.ToSqlField f, Preql.Wire.ToSql.ToSqlField g, Preql.Wire.ToSql.ToSqlField h, Preql.Wire.ToSql.ToSqlField i, Preql.Wire.ToSql.ToSqlField j, Preql.Wire.ToSql.ToSqlField k, Preql.Wire.ToSql.ToSqlField l, Preql.Wire.ToSql.ToSqlField m, Preql.Wire.ToSql.ToSqlField n, Preql.Wire.ToSql.ToSqlField o, Preql.Wire.ToSql.ToSqlField p, Preql.Wire.ToSql.ToSqlField q, Preql.Wire.ToSql.ToSqlField r) => Preql.Wire.ToSql.ToSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) instance (Preql.Wire.ToSql.ToSqlField a, Preql.Wire.ToSql.ToSqlField b, Preql.Wire.ToSql.ToSqlField c, Preql.Wire.ToSql.ToSqlField d, Preql.Wire.ToSql.ToSqlField e, Preql.Wire.ToSql.ToSqlField f, Preql.Wire.ToSql.ToSqlField g, Preql.Wire.ToSql.ToSqlField h, Preql.Wire.ToSql.ToSqlField i, Preql.Wire.ToSql.ToSqlField j, Preql.Wire.ToSql.ToSqlField k, Preql.Wire.ToSql.ToSqlField l, Preql.Wire.ToSql.ToSqlField m, Preql.Wire.ToSql.ToSqlField n, Preql.Wire.ToSql.ToSqlField o, Preql.Wire.ToSql.ToSqlField p, Preql.Wire.ToSql.ToSqlField q) => Preql.Wire.ToSql.ToSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) instance (Preql.Wire.ToSql.ToSqlField a, Preql.Wire.ToSql.ToSqlField b, Preql.Wire.ToSql.ToSqlField c, Preql.Wire.ToSql.ToSqlField d, Preql.Wire.ToSql.ToSqlField e, Preql.Wire.ToSql.ToSqlField f, Preql.Wire.ToSql.ToSqlField g, Preql.Wire.ToSql.ToSqlField h, Preql.Wire.ToSql.ToSqlField i, Preql.Wire.ToSql.ToSqlField j, Preql.Wire.ToSql.ToSqlField k, Preql.Wire.ToSql.ToSqlField l, Preql.Wire.ToSql.ToSqlField m, Preql.Wire.ToSql.ToSqlField n, Preql.Wire.ToSql.ToSqlField o, Preql.Wire.ToSql.ToSqlField p) => Preql.Wire.ToSql.ToSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) instance (Preql.Wire.ToSql.ToSqlField a, Preql.Wire.ToSql.ToSqlField b, Preql.Wire.ToSql.ToSqlField c, Preql.Wire.ToSql.ToSqlField d, Preql.Wire.ToSql.ToSqlField e, Preql.Wire.ToSql.ToSqlField f, Preql.Wire.ToSql.ToSqlField g, Preql.Wire.ToSql.ToSqlField h, Preql.Wire.ToSql.ToSqlField i, Preql.Wire.ToSql.ToSqlField j, Preql.Wire.ToSql.ToSqlField k, Preql.Wire.ToSql.ToSqlField l, Preql.Wire.ToSql.ToSqlField m, Preql.Wire.ToSql.ToSqlField n, Preql.Wire.ToSql.ToSqlField o) => Preql.Wire.ToSql.ToSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) instance (Preql.Wire.ToSql.ToSqlField a, Preql.Wire.ToSql.ToSqlField b, Preql.Wire.ToSql.ToSqlField c, Preql.Wire.ToSql.ToSqlField d, Preql.Wire.ToSql.ToSqlField e, Preql.Wire.ToSql.ToSqlField f, Preql.Wire.ToSql.ToSqlField g, Preql.Wire.ToSql.ToSqlField h, Preql.Wire.ToSql.ToSqlField i, Preql.Wire.ToSql.ToSqlField j, Preql.Wire.ToSql.ToSqlField k, Preql.Wire.ToSql.ToSqlField l, Preql.Wire.ToSql.ToSqlField m, Preql.Wire.ToSql.ToSqlField n) => Preql.Wire.ToSql.ToSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n) instance (Preql.Wire.ToSql.ToSqlField a, Preql.Wire.ToSql.ToSqlField b, Preql.Wire.ToSql.ToSqlField c, Preql.Wire.ToSql.ToSqlField d, Preql.Wire.ToSql.ToSqlField e, Preql.Wire.ToSql.ToSqlField f, Preql.Wire.ToSql.ToSqlField g, Preql.Wire.ToSql.ToSqlField h, Preql.Wire.ToSql.ToSqlField i, Preql.Wire.ToSql.ToSqlField j, Preql.Wire.ToSql.ToSqlField k, Preql.Wire.ToSql.ToSqlField l, Preql.Wire.ToSql.ToSqlField m) => Preql.Wire.ToSql.ToSql (a, b, c, d, e, f, g, h, i, j, k, l, m) instance (Preql.Wire.ToSql.ToSqlField a, Preql.Wire.ToSql.ToSqlField b, Preql.Wire.ToSql.ToSqlField c, Preql.Wire.ToSql.ToSqlField d, Preql.Wire.ToSql.ToSqlField e, Preql.Wire.ToSql.ToSqlField f, Preql.Wire.ToSql.ToSqlField g, Preql.Wire.ToSql.ToSqlField h, Preql.Wire.ToSql.ToSqlField i, Preql.Wire.ToSql.ToSqlField j, Preql.Wire.ToSql.ToSqlField k, Preql.Wire.ToSql.ToSqlField l) => Preql.Wire.ToSql.ToSql (a, b, c, d, e, f, g, h, i, j, k, l) instance (Preql.Wire.ToSql.ToSqlField a, Preql.Wire.ToSql.ToSqlField b, Preql.Wire.ToSql.ToSqlField c, Preql.Wire.ToSql.ToSqlField d, Preql.Wire.ToSql.ToSqlField e, Preql.Wire.ToSql.ToSqlField f, Preql.Wire.ToSql.ToSqlField g, Preql.Wire.ToSql.ToSqlField h, Preql.Wire.ToSql.ToSqlField i, Preql.Wire.ToSql.ToSqlField j, Preql.Wire.ToSql.ToSqlField k) => Preql.Wire.ToSql.ToSql (a, b, c, d, e, f, g, h, i, j, k) instance (Preql.Wire.ToSql.ToSqlField a, Preql.Wire.ToSql.ToSqlField b, Preql.Wire.ToSql.ToSqlField c, Preql.Wire.ToSql.ToSqlField d, Preql.Wire.ToSql.ToSqlField e, Preql.Wire.ToSql.ToSqlField f, Preql.Wire.ToSql.ToSqlField g, Preql.Wire.ToSql.ToSqlField h, Preql.Wire.ToSql.ToSqlField i, Preql.Wire.ToSql.ToSqlField j) => Preql.Wire.ToSql.ToSql (a, b, c, d, e, f, g, h, i, j) instance (Preql.Wire.ToSql.ToSqlField a, Preql.Wire.ToSql.ToSqlField b, Preql.Wire.ToSql.ToSqlField c, Preql.Wire.ToSql.ToSqlField d, Preql.Wire.ToSql.ToSqlField e, Preql.Wire.ToSql.ToSqlField f, Preql.Wire.ToSql.ToSqlField g, Preql.Wire.ToSql.ToSqlField h, Preql.Wire.ToSql.ToSqlField i) => Preql.Wire.ToSql.ToSql (a, b, c, d, e, f, g, h, i) instance (Preql.Wire.ToSql.ToSqlField a, Preql.Wire.ToSql.ToSqlField b, Preql.Wire.ToSql.ToSqlField c, Preql.Wire.ToSql.ToSqlField d, Preql.Wire.ToSql.ToSqlField e, Preql.Wire.ToSql.ToSqlField f, Preql.Wire.ToSql.ToSqlField g, Preql.Wire.ToSql.ToSqlField h) => Preql.Wire.ToSql.ToSql (a, b, c, d, e, f, g, h) instance (Preql.Wire.ToSql.ToSqlField a, Preql.Wire.ToSql.ToSqlField b, Preql.Wire.ToSql.ToSqlField c, Preql.Wire.ToSql.ToSqlField d, Preql.Wire.ToSql.ToSqlField e, Preql.Wire.ToSql.ToSqlField f, Preql.Wire.ToSql.ToSqlField g) => Preql.Wire.ToSql.ToSql (a, b, c, d, e, f, g) instance (Preql.Wire.ToSql.ToSqlField a, Preql.Wire.ToSql.ToSqlField b, Preql.Wire.ToSql.ToSqlField c, Preql.Wire.ToSql.ToSqlField d, Preql.Wire.ToSql.ToSqlField e, Preql.Wire.ToSql.ToSqlField f) => Preql.Wire.ToSql.ToSql (a, b, c, d, e, f) instance (Preql.Wire.ToSql.ToSqlField a, Preql.Wire.ToSql.ToSqlField b, Preql.Wire.ToSql.ToSqlField c, Preql.Wire.ToSql.ToSqlField d, Preql.Wire.ToSql.ToSqlField e) => Preql.Wire.ToSql.ToSql (a, b, c, d, e) instance (Preql.Wire.ToSql.ToSqlField a, Preql.Wire.ToSql.ToSqlField b, Preql.Wire.ToSql.ToSqlField c, Preql.Wire.ToSql.ToSqlField d) => Preql.Wire.ToSql.ToSql (a, b, c, d) instance Preql.Wire.ToSql.ToSql GHC.Types.Bool instance Preql.Wire.ToSql.ToSql GHC.Int.Int16 instance Preql.Wire.ToSql.ToSql GHC.Int.Int32 instance Preql.Wire.ToSql.ToSql GHC.Int.Int64 instance Preql.Wire.ToSql.ToSql GHC.Types.Float instance Preql.Wire.ToSql.ToSql GHC.Types.Double instance Preql.Wire.ToSql.ToSql GHC.Types.Char instance Preql.Wire.ToSql.ToSql GHC.Base.String instance Preql.Wire.ToSql.ToSql Data.Text.Internal.Text instance Preql.Wire.ToSql.ToSql Data.Text.Internal.Lazy.Text instance Preql.Wire.ToSql.ToSql Data.ByteString.Internal.ByteString instance Preql.Wire.ToSql.ToSql Data.ByteString.Lazy.Internal.ByteString instance Preql.Wire.ToSql.ToSql Data.Time.Clock.Internal.UTCTime.UTCTime instance Preql.Wire.ToSql.ToSql Data.Time.Calendar.Days.Day instance Preql.Wire.ToSql.ToSql Data.Time.LocalTime.Internal.TimeOfDay.TimeOfDay instance Preql.Wire.ToSql.ToSql Preql.Wire.Types.TimeTZ instance Preql.Wire.ToSql.ToSql Data.UUID.Types.Internal.UUID instance Preql.Wire.ToSql.ToSql Data.Aeson.Types.Internal.Value instance Preql.Wire.ToSql.ToSql () instance (Preql.Wire.ToSql.ToSqlField a, Preql.Wire.ToSql.ToSqlField b) => Preql.Wire.ToSql.ToSql (a, b) instance (Preql.Wire.ToSql.ToSqlField a, Preql.Wire.ToSql.ToSqlField b, Preql.Wire.ToSql.ToSqlField c) => Preql.Wire.ToSql.ToSql (a, b, c) instance Preql.Wire.ToSql.ToSqlField GHC.Types.Bool instance Preql.Wire.ToSql.ToSqlField GHC.Int.Int16 instance Preql.Wire.ToSql.ToSqlField GHC.Int.Int32 instance Preql.Wire.ToSql.ToSqlField GHC.Int.Int64 instance Preql.Wire.ToSql.ToSqlField GHC.Types.Float instance Preql.Wire.ToSql.ToSqlField GHC.Types.Double instance Preql.Wire.ToSql.ToSqlField GHC.Types.Char instance Preql.Wire.ToSql.ToSqlField GHC.Base.String instance Preql.Wire.ToSql.ToSqlField Data.Text.Internal.Text instance Preql.Wire.ToSql.ToSqlField Data.Text.Internal.Lazy.Text instance Preql.Wire.ToSql.ToSqlField Data.ByteString.Internal.ByteString instance Preql.Wire.ToSql.ToSqlField Data.ByteString.Lazy.Internal.ByteString instance Preql.Wire.ToSql.ToSqlField Data.Time.Clock.Internal.UTCTime.UTCTime instance Preql.Wire.ToSql.ToSqlField Data.Time.Calendar.Days.Day instance Preql.Wire.ToSql.ToSqlField Data.Time.LocalTime.Internal.TimeOfDay.TimeOfDay instance Preql.Wire.ToSql.ToSqlField Preql.Wire.Types.TimeTZ instance Preql.Wire.ToSql.ToSqlField Data.UUID.Types.Internal.UUID instance Preql.Wire.ToSql.ToSqlField Data.Aeson.Types.Internal.Value instance Data.Functor.Contravariant.Contravariant Preql.Wire.ToSql.FieldEncoder module Preql.FromSql.Instances fromSqlJsonField :: FromJSON a => FieldDecoder a instance (Preql.FromSql.Class.FromSql a, Preql.FromSql.Class.FromSql b, Preql.FromSql.Class.FromSql c, Preql.FromSql.Class.FromSql d, Preql.FromSql.Class.FromSql e, Preql.FromSql.Class.FromSql f, Preql.FromSql.Class.FromSql g, Preql.FromSql.Class.FromSql h, Preql.FromSql.Class.FromSql i, Preql.FromSql.Class.FromSql j, Preql.FromSql.Class.FromSql k, Preql.FromSql.Class.FromSql l, Preql.FromSql.Class.FromSql m, Preql.FromSql.Class.FromSql n, Preql.FromSql.Class.FromSql o, Preql.FromSql.Class.FromSql p, Preql.FromSql.Class.FromSql q, Preql.FromSql.Class.FromSql r, Preql.FromSql.Class.FromSql s, Preql.FromSql.Class.FromSql t, Preql.FromSql.Class.FromSql u, Preql.FromSql.Class.FromSql v, Preql.FromSql.Class.FromSql w, Preql.FromSql.Class.FromSql x, Preql.FromSql.Class.FromSql y) => Preql.FromSql.Class.FromSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) instance (Preql.FromSql.Class.FromSql a, Preql.FromSql.Class.FromSql b, Preql.FromSql.Class.FromSql c, Preql.FromSql.Class.FromSql d, Preql.FromSql.Class.FromSql e, Preql.FromSql.Class.FromSql f, Preql.FromSql.Class.FromSql g, Preql.FromSql.Class.FromSql h, Preql.FromSql.Class.FromSql i, Preql.FromSql.Class.FromSql j, Preql.FromSql.Class.FromSql k, Preql.FromSql.Class.FromSql l, Preql.FromSql.Class.FromSql m, Preql.FromSql.Class.FromSql n, Preql.FromSql.Class.FromSql o, Preql.FromSql.Class.FromSql p, Preql.FromSql.Class.FromSql q, Preql.FromSql.Class.FromSql r, Preql.FromSql.Class.FromSql s, Preql.FromSql.Class.FromSql t, Preql.FromSql.Class.FromSql u, Preql.FromSql.Class.FromSql v, Preql.FromSql.Class.FromSql w, Preql.FromSql.Class.FromSql x) => Preql.FromSql.Class.FromSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) instance (Preql.FromSql.Class.FromSql a, Preql.FromSql.Class.FromSql b, Preql.FromSql.Class.FromSql c, Preql.FromSql.Class.FromSql d, Preql.FromSql.Class.FromSql e, Preql.FromSql.Class.FromSql f, Preql.FromSql.Class.FromSql g, Preql.FromSql.Class.FromSql h, Preql.FromSql.Class.FromSql i, Preql.FromSql.Class.FromSql j, Preql.FromSql.Class.FromSql k, Preql.FromSql.Class.FromSql l, Preql.FromSql.Class.FromSql m, Preql.FromSql.Class.FromSql n, Preql.FromSql.Class.FromSql o, Preql.FromSql.Class.FromSql p, Preql.FromSql.Class.FromSql q, Preql.FromSql.Class.FromSql r, Preql.FromSql.Class.FromSql s, Preql.FromSql.Class.FromSql t, Preql.FromSql.Class.FromSql u, Preql.FromSql.Class.FromSql v, Preql.FromSql.Class.FromSql w) => Preql.FromSql.Class.FromSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) instance (Preql.FromSql.Class.FromSql a, Preql.FromSql.Class.FromSql b, Preql.FromSql.Class.FromSql c, Preql.FromSql.Class.FromSql d, Preql.FromSql.Class.FromSql e, Preql.FromSql.Class.FromSql f, Preql.FromSql.Class.FromSql g, Preql.FromSql.Class.FromSql h, Preql.FromSql.Class.FromSql i, Preql.FromSql.Class.FromSql j, Preql.FromSql.Class.FromSql k, Preql.FromSql.Class.FromSql l, Preql.FromSql.Class.FromSql m, Preql.FromSql.Class.FromSql n, Preql.FromSql.Class.FromSql o, Preql.FromSql.Class.FromSql p, Preql.FromSql.Class.FromSql q, Preql.FromSql.Class.FromSql r, Preql.FromSql.Class.FromSql s, Preql.FromSql.Class.FromSql t, Preql.FromSql.Class.FromSql u, Preql.FromSql.Class.FromSql v) => Preql.FromSql.Class.FromSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) instance (Preql.FromSql.Class.FromSql a, Preql.FromSql.Class.FromSql b, Preql.FromSql.Class.FromSql c, Preql.FromSql.Class.FromSql d, Preql.FromSql.Class.FromSql e, Preql.FromSql.Class.FromSql f, Preql.FromSql.Class.FromSql g, Preql.FromSql.Class.FromSql h, Preql.FromSql.Class.FromSql i, Preql.FromSql.Class.FromSql j, Preql.FromSql.Class.FromSql k, Preql.FromSql.Class.FromSql l, Preql.FromSql.Class.FromSql m, Preql.FromSql.Class.FromSql n, Preql.FromSql.Class.FromSql o, Preql.FromSql.Class.FromSql p, Preql.FromSql.Class.FromSql q, Preql.FromSql.Class.FromSql r, Preql.FromSql.Class.FromSql s, Preql.FromSql.Class.FromSql t, Preql.FromSql.Class.FromSql u) => Preql.FromSql.Class.FromSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) instance (Preql.FromSql.Class.FromSql a, Preql.FromSql.Class.FromSql b, Preql.FromSql.Class.FromSql c, Preql.FromSql.Class.FromSql d, Preql.FromSql.Class.FromSql e, Preql.FromSql.Class.FromSql f, Preql.FromSql.Class.FromSql g, Preql.FromSql.Class.FromSql h, Preql.FromSql.Class.FromSql i, Preql.FromSql.Class.FromSql j, Preql.FromSql.Class.FromSql k, Preql.FromSql.Class.FromSql l, Preql.FromSql.Class.FromSql m, Preql.FromSql.Class.FromSql n, Preql.FromSql.Class.FromSql o, Preql.FromSql.Class.FromSql p, Preql.FromSql.Class.FromSql q, Preql.FromSql.Class.FromSql r, Preql.FromSql.Class.FromSql s, Preql.FromSql.Class.FromSql t) => Preql.FromSql.Class.FromSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) instance (Preql.FromSql.Class.FromSql a, Preql.FromSql.Class.FromSql b, Preql.FromSql.Class.FromSql c, Preql.FromSql.Class.FromSql d, Preql.FromSql.Class.FromSql e, Preql.FromSql.Class.FromSql f, Preql.FromSql.Class.FromSql g, Preql.FromSql.Class.FromSql h, Preql.FromSql.Class.FromSql i, Preql.FromSql.Class.FromSql j, Preql.FromSql.Class.FromSql k, Preql.FromSql.Class.FromSql l, Preql.FromSql.Class.FromSql m, Preql.FromSql.Class.FromSql n, Preql.FromSql.Class.FromSql o, Preql.FromSql.Class.FromSql p, Preql.FromSql.Class.FromSql q, Preql.FromSql.Class.FromSql r, Preql.FromSql.Class.FromSql s) => Preql.FromSql.Class.FromSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) instance (Preql.FromSql.Class.FromSql a, Preql.FromSql.Class.FromSql b, Preql.FromSql.Class.FromSql c, Preql.FromSql.Class.FromSql d, Preql.FromSql.Class.FromSql e, Preql.FromSql.Class.FromSql f, Preql.FromSql.Class.FromSql g, Preql.FromSql.Class.FromSql h, Preql.FromSql.Class.FromSql i, Preql.FromSql.Class.FromSql j, Preql.FromSql.Class.FromSql k, Preql.FromSql.Class.FromSql l, Preql.FromSql.Class.FromSql m, Preql.FromSql.Class.FromSql n, Preql.FromSql.Class.FromSql o, Preql.FromSql.Class.FromSql p, Preql.FromSql.Class.FromSql q, Preql.FromSql.Class.FromSql r) => Preql.FromSql.Class.FromSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) instance (Preql.FromSql.Class.FromSql a, Preql.FromSql.Class.FromSql b, Preql.FromSql.Class.FromSql c, Preql.FromSql.Class.FromSql d, Preql.FromSql.Class.FromSql e, Preql.FromSql.Class.FromSql f, Preql.FromSql.Class.FromSql g, Preql.FromSql.Class.FromSql h, Preql.FromSql.Class.FromSql i, Preql.FromSql.Class.FromSql j, Preql.FromSql.Class.FromSql k, Preql.FromSql.Class.FromSql l, Preql.FromSql.Class.FromSql m, Preql.FromSql.Class.FromSql n, Preql.FromSql.Class.FromSql o, Preql.FromSql.Class.FromSql p, Preql.FromSql.Class.FromSql q) => Preql.FromSql.Class.FromSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) instance (Preql.FromSql.Class.FromSql a, Preql.FromSql.Class.FromSql b, Preql.FromSql.Class.FromSql c, Preql.FromSql.Class.FromSql d, Preql.FromSql.Class.FromSql e, Preql.FromSql.Class.FromSql f, Preql.FromSql.Class.FromSql g, Preql.FromSql.Class.FromSql h, Preql.FromSql.Class.FromSql i, Preql.FromSql.Class.FromSql j, Preql.FromSql.Class.FromSql k, Preql.FromSql.Class.FromSql l, Preql.FromSql.Class.FromSql m, Preql.FromSql.Class.FromSql n, Preql.FromSql.Class.FromSql o, Preql.FromSql.Class.FromSql p) => Preql.FromSql.Class.FromSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) instance (Preql.FromSql.Class.FromSql a, Preql.FromSql.Class.FromSql b, Preql.FromSql.Class.FromSql c, Preql.FromSql.Class.FromSql d, Preql.FromSql.Class.FromSql e, Preql.FromSql.Class.FromSql f, Preql.FromSql.Class.FromSql g, Preql.FromSql.Class.FromSql h, Preql.FromSql.Class.FromSql i, Preql.FromSql.Class.FromSql j, Preql.FromSql.Class.FromSql k, Preql.FromSql.Class.FromSql l, Preql.FromSql.Class.FromSql m, Preql.FromSql.Class.FromSql n, Preql.FromSql.Class.FromSql o) => Preql.FromSql.Class.FromSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) instance (Preql.FromSql.Class.FromSql a, Preql.FromSql.Class.FromSql b, Preql.FromSql.Class.FromSql c, Preql.FromSql.Class.FromSql d, Preql.FromSql.Class.FromSql e, Preql.FromSql.Class.FromSql f, Preql.FromSql.Class.FromSql g, Preql.FromSql.Class.FromSql h, Preql.FromSql.Class.FromSql i, Preql.FromSql.Class.FromSql j, Preql.FromSql.Class.FromSql k, Preql.FromSql.Class.FromSql l, Preql.FromSql.Class.FromSql m, Preql.FromSql.Class.FromSql n) => Preql.FromSql.Class.FromSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n) instance (Preql.FromSql.Class.FromSql a, Preql.FromSql.Class.FromSql b, Preql.FromSql.Class.FromSql c, Preql.FromSql.Class.FromSql d, Preql.FromSql.Class.FromSql e, Preql.FromSql.Class.FromSql f, Preql.FromSql.Class.FromSql g, Preql.FromSql.Class.FromSql h, Preql.FromSql.Class.FromSql i, Preql.FromSql.Class.FromSql j, Preql.FromSql.Class.FromSql k, Preql.FromSql.Class.FromSql l, Preql.FromSql.Class.FromSql m) => Preql.FromSql.Class.FromSql (a, b, c, d, e, f, g, h, i, j, k, l, m) instance (Preql.FromSql.Class.FromSql a, Preql.FromSql.Class.FromSql b, Preql.FromSql.Class.FromSql c, Preql.FromSql.Class.FromSql d, Preql.FromSql.Class.FromSql e, Preql.FromSql.Class.FromSql f, Preql.FromSql.Class.FromSql g, Preql.FromSql.Class.FromSql h, Preql.FromSql.Class.FromSql i, Preql.FromSql.Class.FromSql j, Preql.FromSql.Class.FromSql k, Preql.FromSql.Class.FromSql l) => Preql.FromSql.Class.FromSql (a, b, c, d, e, f, g, h, i, j, k, l) instance (Preql.FromSql.Class.FromSql a, Preql.FromSql.Class.FromSql b, Preql.FromSql.Class.FromSql c, Preql.FromSql.Class.FromSql d, Preql.FromSql.Class.FromSql e, Preql.FromSql.Class.FromSql f, Preql.FromSql.Class.FromSql g, Preql.FromSql.Class.FromSql h, Preql.FromSql.Class.FromSql i, Preql.FromSql.Class.FromSql j, Preql.FromSql.Class.FromSql k) => Preql.FromSql.Class.FromSql (a, b, c, d, e, f, g, h, i, j, k) instance (Preql.FromSql.Class.FromSql a, Preql.FromSql.Class.FromSql b, Preql.FromSql.Class.FromSql c, Preql.FromSql.Class.FromSql d, Preql.FromSql.Class.FromSql e, Preql.FromSql.Class.FromSql f, Preql.FromSql.Class.FromSql g, Preql.FromSql.Class.FromSql h, Preql.FromSql.Class.FromSql i, Preql.FromSql.Class.FromSql j) => Preql.FromSql.Class.FromSql (a, b, c, d, e, f, g, h, i, j) instance (Preql.FromSql.Class.FromSql a, Preql.FromSql.Class.FromSql b, Preql.FromSql.Class.FromSql c, Preql.FromSql.Class.FromSql d, Preql.FromSql.Class.FromSql e, Preql.FromSql.Class.FromSql f, Preql.FromSql.Class.FromSql g, Preql.FromSql.Class.FromSql h, Preql.FromSql.Class.FromSql i) => Preql.FromSql.Class.FromSql (a, b, c, d, e, f, g, h, i) instance (Preql.FromSql.Class.FromSql a, Preql.FromSql.Class.FromSql b, Preql.FromSql.Class.FromSql c, Preql.FromSql.Class.FromSql d, Preql.FromSql.Class.FromSql e, Preql.FromSql.Class.FromSql f, Preql.FromSql.Class.FromSql g, Preql.FromSql.Class.FromSql h) => Preql.FromSql.Class.FromSql (a, b, c, d, e, f, g, h) instance (Preql.FromSql.Class.FromSql a, Preql.FromSql.Class.FromSql b, Preql.FromSql.Class.FromSql c, Preql.FromSql.Class.FromSql d, Preql.FromSql.Class.FromSql e, Preql.FromSql.Class.FromSql f, Preql.FromSql.Class.FromSql g) => Preql.FromSql.Class.FromSql (a, b, c, d, e, f, g) instance (Preql.FromSql.Class.FromSql a, Preql.FromSql.Class.FromSql b, Preql.FromSql.Class.FromSql c, Preql.FromSql.Class.FromSql d, Preql.FromSql.Class.FromSql e, Preql.FromSql.Class.FromSql f) => Preql.FromSql.Class.FromSql (a, b, c, d, e, f) instance (Preql.FromSql.Class.FromSql a, Preql.FromSql.Class.FromSql b, Preql.FromSql.Class.FromSql c, Preql.FromSql.Class.FromSql d, Preql.FromSql.Class.FromSql e) => Preql.FromSql.Class.FromSql (a, b, c, d, e) instance (Preql.FromSql.Class.FromSql a, Preql.FromSql.Class.FromSql b, Preql.FromSql.Class.FromSql c, Preql.FromSql.Class.FromSql d) => Preql.FromSql.Class.FromSql (a, b, c, d) instance Preql.FromSql.Class.FromSqlField GHC.Types.Bool instance Preql.FromSql.Class.FromSql GHC.Types.Bool instance Preql.FromSql.Class.FromSqlField GHC.Int.Int16 instance Preql.FromSql.Class.FromSql GHC.Int.Int16 instance Preql.FromSql.Class.FromSqlField GHC.Int.Int32 instance Preql.FromSql.Class.FromSql GHC.Int.Int32 instance Preql.FromSql.Class.FromSqlField GHC.Int.Int64 instance Preql.FromSql.Class.FromSql GHC.Int.Int64 instance Preql.FromSql.Class.FromSqlField GHC.Types.Float instance Preql.FromSql.Class.FromSql GHC.Types.Float instance Preql.FromSql.Class.FromSqlField GHC.Types.Double instance Preql.FromSql.Class.FromSql GHC.Types.Double instance Preql.FromSql.Class.FromSqlField GHC.Base.String instance Preql.FromSql.Class.FromSql GHC.Base.String instance Preql.FromSql.Class.FromSqlField Data.Text.Internal.Text instance Preql.FromSql.Class.FromSql Data.Text.Internal.Text instance Preql.FromSql.Class.FromSqlField Data.Text.Internal.Lazy.Text instance Preql.FromSql.Class.FromSql Data.Text.Internal.Lazy.Text instance Preql.FromSql.Class.FromSqlField Data.ByteString.Internal.ByteString instance Preql.FromSql.Class.FromSql Data.ByteString.Internal.ByteString instance Preql.FromSql.Class.FromSqlField Data.ByteString.Lazy.Internal.ByteString instance Preql.FromSql.Class.FromSql Data.ByteString.Lazy.Internal.ByteString instance Preql.FromSql.Class.FromSqlField Data.Time.Clock.Internal.UTCTime.UTCTime instance Preql.FromSql.Class.FromSql Data.Time.Clock.Internal.UTCTime.UTCTime instance Preql.FromSql.Class.FromSqlField Data.Time.Calendar.Days.Day instance Preql.FromSql.Class.FromSql Data.Time.Calendar.Days.Day instance Preql.FromSql.Class.FromSqlField Data.Time.LocalTime.Internal.TimeOfDay.TimeOfDay instance Preql.FromSql.Class.FromSql Data.Time.LocalTime.Internal.TimeOfDay.TimeOfDay instance Preql.FromSql.Class.FromSqlField Preql.Wire.Types.TimeTZ instance Preql.FromSql.Class.FromSql Preql.Wire.Types.TimeTZ instance Preql.FromSql.Class.FromSqlField Data.UUID.Types.Internal.UUID instance Preql.FromSql.Class.FromSql Data.UUID.Types.Internal.UUID instance Preql.FromSql.Class.FromSqlField Database.PostgreSQL.LibPQ.Oid instance Preql.FromSql.Class.FromSql Database.PostgreSQL.LibPQ.Oid instance Preql.FromSql.Class.FromSqlField Data.Aeson.Types.Internal.Value instance Preql.FromSql.Class.FromSql Data.Aeson.Types.Internal.Value instance Preql.FromSql.Class.FromSqlField a => Preql.FromSql.Class.FromSql (GHC.Maybe.Maybe a) instance (Preql.FromSql.Class.FromSql a, Preql.FromSql.Class.FromSql b) => Preql.FromSql.Class.FromSql (a, b) instance (Preql.FromSql.Class.FromSql a, Preql.FromSql.Class.FromSql b, Preql.FromSql.Class.FromSql c) => Preql.FromSql.Class.FromSql (a, b, c) -- | re-export Preql.FromSql.* module Preql.FromSql module Preql.Wire.Query queryWith :: KnownNat (Width r) => RowEncoder p -> RowDecoder (Width r) r -> Connection -> Query (Width r) -> p -> IO (Either QueryError (Vector r)) queryWith_ :: RowEncoder p -> Connection -> Query n -> p -> IO (Either QueryError ()) query :: (ToSql p, FromSql r, KnownNat (Width r)) => Connection -> Query (Width r) -> p -> IO (Either QueryError (Vector r)) query_ :: ToSql p => Connection -> Query n -> p -> IO (Either QueryError ()) execParams :: RowEncoder p -> Connection -> ByteString -> p -> IO (Either QueryError Result) connectionError :: Connection -> Maybe a -> IO (Either Text a) lookupType :: Connection -> PgType -> IO (Either QueryError Oid) data IsolationLevel ReadCommitted :: IsolationLevel RepeatableRead :: IsolationLevel Serializable :: IsolationLevel begin :: Connection -> IsolationLevel -> IO (Either QueryError ()) commit :: Connection -> IO (Either QueryError ()) rollback :: Connection -> IO (Either QueryError ()) instance GHC.Enum.Bounded Preql.Wire.Query.IsolationLevel instance GHC.Enum.Enum Preql.Wire.Query.IsolationLevel instance GHC.Classes.Ord Preql.Wire.Query.IsolationLevel instance GHC.Classes.Eq Preql.Wire.Query.IsolationLevel instance GHC.Read.Read Preql.Wire.Query.IsolationLevel instance GHC.Show.Show Preql.Wire.Query.IsolationLevel -- | This module re-exports definitions from Wire.* that are expected to be -- useful module Preql.Wire -- | A type which can be decoded from a SQL row. Note that this includes -- the canonical order of fields. -- -- The default (empty) instance works for any type with a -- FromSqlField instance class FromSql a where { -- | The number of columns read in decoding this type. type family Width a :: Nat; type Width a = 1; } fromSql :: FromSql a => RowDecoder (Width a) a fromSql :: (FromSql a, FromSqlField a, Width a ~ 1) => RowDecoder (Width a) a class FromSqlField a -- | ToSql a is sufficient to pass a as parameters to a -- paramaterized query. class ToSql a toSql :: ToSql a => RowEncoder a -- | Types which can be encoded to a single Postgres field. class ToSqlField a data QueryError ConnectionError :: Text -> QueryError DecoderError :: FieldError -> QueryError PgTypeMismatch :: [TypeMismatch] -> QueryError -- | A decoding error with information about the row & column of the -- result where it occured. data FieldError FieldError :: Int -> Int -> UnlocatedFieldError -> FieldError [errorRow] :: FieldError -> Int [errorColumn] :: FieldError -> Int [failure] :: FieldError -> UnlocatedFieldError -- | Errors that can occur in decoding a single field. data UnlocatedFieldError UnexpectedNull :: UnlocatedFieldError ParseFailure :: Text -> UnlocatedFieldError data TypeMismatch TypeMismatch :: PgType -> Oid -> Int -> Maybe Text -> TypeMismatch [expected] :: TypeMismatch -> PgType [actual] :: TypeMismatch -> Oid [column] :: TypeMismatch -> Int [columnName] :: TypeMismatch -> Maybe Text -- | Errors that can occur in decoding a single field. data UnlocatedFieldError UnexpectedNull :: UnlocatedFieldError ParseFailure :: Text -> UnlocatedFieldError -- | A decoding error with information about the row & column of the -- result where it occured. data FieldError FieldError :: Int -> Int -> UnlocatedFieldError -> FieldError [errorRow] :: FieldError -> Int [errorColumn] :: FieldError -> Int [failure] :: FieldError -> UnlocatedFieldError data PgType -- | A Postgres type with a known ID Oid :: Oid -> PgType -- | A Postgres type which we will need to lookup by name TypeName :: Text -> PgType data TypeMismatch TypeMismatch :: PgType -> Oid -> Int -> Maybe Text -> TypeMismatch [expected] :: TypeMismatch -> PgType [actual] :: TypeMismatch -> Oid [column] :: TypeMismatch -> Int [columnName] :: TypeMismatch -> Maybe Text data QueryError ConnectionError :: Text -> QueryError DecoderError :: FieldError -> QueryError PgTypeMismatch :: [TypeMismatch] -> QueryError -- | RowDecoder is Functor but not Monad so that we -- can index the type by the number of columns that it consumes. We also -- know & verify all of the OIDs before we read any of the field data -- sent by Postgres, which would admit an Applicative instance but -- not Monad data RowDecoder (n :: Nat) a -- | The IsString instance does no validation; the limited instances -- discourage directly manipulating strings, with the high risk of SQL -- injection. A Query is tagged with a Nat representing -- the width of its return type. data Query (n :: Nat) decodeVector :: KnownNat n => (PgType -> IO (Either QueryError Oid)) -> RowDecoder n a -> Result -> IO (Either QueryError (Vector a)) -- | A type which can be decoded from a SQL row. Note that this includes -- the canonical order of fields. -- -- The default (empty) instance works for any type with a -- FromSqlField instance class FromSql a where { -- | The number of columns read in decoding this type. type family Width a :: Nat; type Width a = 1; } fromSql :: FromSql a => RowDecoder (Width a) a fromSql :: (FromSql a, FromSqlField a, Width a ~ 1) => RowDecoder (Width a) a class FromSqlField a fromSqlField :: FromSqlField a => FieldDecoder a -- | A FieldDecoder for a type a consists of an OID -- indicating the Postgres type which can be decoded, and a parser from -- the binary representation of that type to the Haskell representation. data FieldDecoder a FieldDecoder :: PgType -> BinaryParser a -> FieldDecoder a -- | Construct a decoder for a single non-nullable column. notNull :: FieldDecoder a -> RowDecoder 1 a -- | Construct a decoder for a single nullable column. nullable :: FieldDecoder a -> RowDecoder 1 (Maybe a) throwLocated :: UnlocatedFieldError -> InternalDecoder a data TimeTZ TimeTZ :: !TimeOfDay -> !TimeZone -> TimeTZ -- | ToSql a is sufficient to pass a as parameters to a -- paramaterized query. class ToSql a toSql :: ToSql a => RowEncoder a -- | Types which can be encoded to a single Postgres field. class ToSqlField a toSqlField :: ToSqlField a => FieldEncoder a type RowEncoder a = a -> [(Oid, ByteString)] -- | A FieldEncoder for a type a consists of a function -- from a to it's binary representation, and an Postgres OID -- which tells Postgres it's type & how to decode it. data FieldEncoder a FieldEncoder :: Oid -> (a -> Builder) -> FieldEncoder a runFieldEncoder :: FieldEncoder p -> p -> (Oid, ByteString) runEncoder :: RowEncoder p -> p -> [Maybe (Oid, ByteString, Format)] oneField :: FieldEncoder a -> RowEncoder a toSqlJsonField :: ToJSON a => FieldEncoder a data IsolationLevel ReadCommitted :: IsolationLevel RepeatableRead :: IsolationLevel Serializable :: IsolationLevel module Preql.QuasiQuoter.Raw.TH -- | Convert a rewritten SQL string to a ByteString, leaving width free makeQuery :: String -> Q Exp -- | Given a SQL query with ${} antiquotes, splice a pair (Query p r, -- p) or a function p' -> (Query p r, p) if the SQL -- string includes both antiquote and positional parameters. -- -- The sql Quasiquoter allows passing parameters to a query by -- name, inside a ${} antiquote. For example: [sql| SELECT -- name, age FROM cats WHERE age >= ${minAge} and age < ${maxAge} -- |] The Haskell term within {} must be a variable in -- scope; more complex expressions are not supported. -- -- Antiquotes are replaced by positional ($1, $2) parameters -- supported by Postgres, and the encoded values are sent with -- PexecParams -- -- Mixed named & numbered parameters are also supported. It is hoped -- that this will be useful when migrating existing queries. For example: -- query $ [sql| SELECT name, age FROM cats WHERE age >= ${minAge} -- and age < $1 |] maxAge Named parameters will be assigned -- numbers higher than the highest numbered paramater placeholder. -- -- A quote with only named parameters is converted to a tuple '(Query, -- p)'. For example: ("SELECT name, age FROM cats WHERE age >= $1 -- and age < $2", (minAge, maxAge)) If there are no parameters, -- the inner tuple is (), like ("SELECT * FROM cats", -- ()). If there are both named & numbered params, the splice is -- a function taking a tuple and returning (Query, p) where p -- includes both named & numbered params. For example: a -> -- ("SELECT name, age FROM cats WHERE age >= $1 and age < $2", (a, -- maxAge)) sql :: QuasiQuoter maxParam :: [Token] -> Word numberAntiquotes :: Word -> [Token] -> (String, [String]) -- | We use IO in the representation of Transaction, but we don't want to -- allow arbitrary IO, only SQL queries. So keep it private. module Preql.Effect.Internal -- | A Transaction can only contain SQL queries (and pure functions). newtype Transaction a Transaction :: ExceptT QueryError (ReaderT Connection IO) a -> Transaction a instance GHC.Base.Monad Preql.Effect.Internal.Transaction instance GHC.Base.Applicative Preql.Effect.Internal.Transaction instance GHC.Base.Functor Preql.Effect.Internal.Transaction -- | Effect class, expressing that a database connection is available or -- can be acquired, and transactions run. module Preql.Effect -- | SqlQuery is separate from SQL so that nested -- Transactions are statically prevented. query can be -- used directly within any SQL monad (running a single-statement -- transaction), or within a Transaction. -- -- Users should not need to define instances, as every SQL -- instance implies a SqlQuery instance. class Monad m => SqlQuery (m :: * -> *) -- | Run a parameterized query that returns data. The tuple argument is -- typically provided by one of the Quasiquoters: sql or -- select query :: (SqlQuery m, ToSql p, FromSql r, KnownNat (Width r)) => (Query (Width r), p) -> m (Vector r) -- | Run a parameterized query that does not return data. query_ :: (SqlQuery m, ToSql p) => (Query 0, p) -> m () -- | An Effect class for running SQL queries. You can think of this as a -- context specifying a particular Postgres connection (or connection -- pool). A minimal instance defines withConnection. -- -- Override the remaining methods to log errors before rethrowing, or not -- to rethrow. class SqlQuery m => SQL (m :: * -> *) -- | Run multiple queries in a transaction. runTransaction' :: SQL m => IsolationLevel -> Transaction a -> m a -- | Run multiple queries in a transaction. runTransaction' :: (SQL m, MonadIO m) => IsolationLevel -> Transaction a -> m a -- | runTransaction covers the most common patterns of -- mult-statement transactions. withConnection is useful when -- you want more control, or want to override the defaults that your -- instance defines. For example: - change the number of retries - -- interleave calls to other services with the Postgres transaction - -- ensure a prepared statement is shared among successive transactions withConnection :: SQL m => (Connection -> m a) -> m a -- | Run a query on the specified Connection queryOn :: (SQL m, ToSql p, FromSql r, KnownNat (Width r)) => Connection -> (Query (Width r), p) -> m (Vector r) -- | Run a query on the specified Connection queryOn :: (SQL m, ToSql p, FromSql r, KnownNat (Width r), MonadIO m) => Connection -> (Query (Width r), p) -> m (Vector r) queryOn_ :: (SQL m, ToSql p) => Connection -> (Query 0, p) -> m () queryOn_ :: (SQL m, ToSql p, MonadIO m) => Connection -> (Query 0, p) -> m () -- | Run a Transaction with full Serializable isolation. runTransaction :: SQL m => Transaction a -> m a -- | Run the provided Transaction. If it fails with a -- QueryError, roll back. runTransactionIO :: IsolationLevel -> Transaction a -> Connection -> IO (Either QueryError a) -- | A Transaction can only contain SQL queries (and pure functions). data Transaction a instance Preql.Effect.SQL (Control.Monad.Trans.Reader.ReaderT Database.PostgreSQL.LibPQ.Internal.Connection GHC.Types.IO) instance (GHC.Base.Monad m, Preql.Effect.SQL m) => Preql.Effect.SqlQuery m instance Preql.Effect.SQL m => Preql.Effect.SQL (Control.Monad.Trans.Except.ExceptT e m) instance Preql.Effect.SQL m => Preql.Effect.SQL (Control.Monad.Trans.Reader.ReaderT r m) instance Preql.Effect.SQL m => Preql.Effect.SQL (Control.Monad.Trans.Maybe.MaybeT m) instance Preql.Effect.SQL m => Preql.Effect.SQL (Control.Monad.Trans.State.Lazy.StateT s m) instance Preql.Effect.SQL m => Preql.Effect.SQL (Control.Monad.Trans.State.Strict.StateT s m) instance (GHC.Base.Monoid w, Preql.Effect.SQL m) => Preql.Effect.SQL (Control.Monad.Trans.RWS.Strict.RWST r w s m) instance (GHC.Base.Monoid w, Preql.Effect.SQL m) => Preql.Effect.SQL (Control.Monad.Trans.RWS.Lazy.RWST r w s m) instance Preql.Effect.SqlQuery Preql.Effect.Internal.Transaction module Preql -- | An Effect class for running SQL queries. You can think of this as a -- context specifying a particular Postgres connection (or connection -- pool). A minimal instance defines withConnection. -- -- Override the remaining methods to log errors before rethrowing, or not -- to rethrow. class SqlQuery m => SQL (m :: * -> *) -- | Run multiple queries in a transaction. runTransaction' :: SQL m => IsolationLevel -> Transaction a -> m a -- | Run multiple queries in a transaction. runTransaction' :: (SQL m, MonadIO m) => IsolationLevel -> Transaction a -> m a -- | runTransaction covers the most common patterns of -- mult-statement transactions. withConnection is useful when -- you want more control, or want to override the defaults that your -- instance defines. For example: - change the number of retries - -- interleave calls to other services with the Postgres transaction - -- ensure a prepared statement is shared among successive transactions withConnection :: SQL m => (Connection -> m a) -> m a -- | Run a query on the specified Connection queryOn :: (SQL m, ToSql p, FromSql r, KnownNat (Width r)) => Connection -> (Query (Width r), p) -> m (Vector r) -- | Run a query on the specified Connection queryOn :: (SQL m, ToSql p, FromSql r, KnownNat (Width r), MonadIO m) => Connection -> (Query (Width r), p) -> m (Vector r) queryOn_ :: (SQL m, ToSql p) => Connection -> (Query 0, p) -> m () queryOn_ :: (SQL m, ToSql p, MonadIO m) => Connection -> (Query 0, p) -> m () -- | SqlQuery is separate from SQL so that nested -- Transactions are statically prevented. query can be -- used directly within any SQL monad (running a single-statement -- transaction), or within a Transaction. -- -- Users should not need to define instances, as every SQL -- instance implies a SqlQuery instance. class Monad m => SqlQuery (m :: * -> *) -- | Run a parameterized query that returns data. The tuple argument is -- typically provided by one of the Quasiquoters: sql or -- select query :: (SqlQuery m, ToSql p, FromSql r, KnownNat (Width r)) => (Query (Width r), p) -> m (Vector r) -- | Run a parameterized query that does not return data. query_ :: (SqlQuery m, ToSql p) => (Query 0, p) -> m () -- | Given a SQL query with ${} antiquotes, splice a pair (Query p r, -- p) or a function p' -> (Query p r, p) if the SQL -- string includes both antiquote and positional parameters. -- -- The sql Quasiquoter allows passing parameters to a query by -- name, inside a ${} antiquote. For example: [sql| SELECT -- name, age FROM cats WHERE age >= ${minAge} and age < ${maxAge} -- |] The Haskell term within {} must be a variable in -- scope; more complex expressions are not supported. -- -- Antiquotes are replaced by positional ($1, $2) parameters -- supported by Postgres, and the encoded values are sent with -- PexecParams -- -- Mixed named & numbered parameters are also supported. It is hoped -- that this will be useful when migrating existing queries. For example: -- query $ [sql| SELECT name, age FROM cats WHERE age >= ${minAge} -- and age < $1 |] maxAge Named parameters will be assigned -- numbers higher than the highest numbered paramater placeholder. -- -- A quote with only named parameters is converted to a tuple '(Query, -- p)'. For example: ("SELECT name, age FROM cats WHERE age >= $1 -- and age < $2", (minAge, maxAge)) If there are no parameters, -- the inner tuple is (), like ("SELECT * FROM cats", -- ()). If there are both named & numbered params, the splice is -- a function taking a tuple and returning (Query, p) where p -- includes both named & numbered params. For example: a -> -- ("SELECT name, age FROM cats WHERE age >= $1 and age < $2", (a, -- maxAge)) sql :: QuasiQuoter -- | This quasiquoter will accept most syntactically valid SELECT queries. -- Language features not yet implemented include type casts, lateral -- joins, EXTRACT, INTO, string & XML operators, and user-defined -- operators. For now, please fall back to sql for these -- less-frequently used SQL features, or file a bug report if a commonly -- used feature is not parsed correctly. -- -- select accepts antiquotes with the same syntax as -- sql. select :: QuasiQuoter -- | This quasiquoter will accept all queries accepted by select, -- and limited INSERT, UPDATE, and DELETE queries. For details of what -- can be parsed, consult Parser.y validSql :: QuasiQuoter -- | A Transaction can only contain SQL queries (and pure functions). data Transaction a -- | The IsString instance does no validation; the limited instances -- discourage directly manipulating strings, with the high risk of SQL -- injection. A Query is tagged with a Nat representing -- the width of its return type. data Query (n :: Nat) -- | Run the provided Transaction. If it fails with a -- QueryError, roll back. runTransactionIO :: IsolationLevel -> Transaction a -> Connection -> IO (Either QueryError a) -- | A type which can be decoded from a SQL row. Note that this includes -- the canonical order of fields. -- -- The default (empty) instance works for any type with a -- FromSqlField instance class FromSql a class FromSqlField a -- | ToSql a is sufficient to pass a as parameters to a -- paramaterized query. class ToSql a -- | Types which can be encoded to a single Postgres field. class ToSqlField a data QueryError ConnectionError :: Text -> QueryError DecoderError :: FieldError -> QueryError PgTypeMismatch :: [TypeMismatch] -> QueryError -- | A decoding error with information about the row & column of the -- result where it occured. data FieldError FieldError :: Int -> Int -> UnlocatedFieldError -> FieldError [errorRow] :: FieldError -> Int [errorColumn] :: FieldError -> Int [failure] :: FieldError -> UnlocatedFieldError -- | Errors that can occur in decoding a single field. data UnlocatedFieldError UnexpectedNull :: UnlocatedFieldError ParseFailure :: Text -> UnlocatedFieldError data TypeMismatch TypeMismatch :: PgType -> Oid -> Int -> Maybe Text -> TypeMismatch [expected] :: TypeMismatch -> PgType [actual] :: TypeMismatch -> Oid [column] :: TypeMismatch -> Int [columnName] :: TypeMismatch -> Maybe Text