-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Database Supported Haskell -- -- This is a Haskell library for database-supported program execution. -- Using this library a relational database management system (RDBMS) can -- be used as a coprocessor for the Haskell programming language, -- especially for those program fragments that carry out data-intensive -- and data-parallel computation. -- -- Database executable program fragments can be written using the list -- comprehension notation (with modest syntax changes due to -- quasiquoting) and list processing combinators from the Haskell list -- prelude. Note that rather than embedding a relational language into -- Haskell, we turn idiomatic Haskell programs into SQL queries. -- -- DSH faithfully represents list order and nesting, and compiles the -- list processing combinators into relational queries. The -- implementation avoids unnecessary data transfer and context switching -- between the database coprocessor and the Haskell runtime by ensuring -- that the number of generated relational queries is only determined by -- the program fragment's type and not by the database size. -- -- DSH can be used to allow existing Haskell programs to operate on large -- scale data (e.g., larger than the available heap) or query existing -- database resident data with Haskell. -- -- Note that this package is flagged experimental and therefore not -- suited for production use. This is a proof of concept implementation -- only. To learn more about DSH, our paper entitled as Haskell boards -- the Ferry: Database-supported program execution for Haskell [1] is -- a recommended reading. The package includes a couple of examples that -- demonstrate how to use DSH. -- --
    -- --
  1. http://www-db.informatik.uni-tuebingen.de/files/publications/ferryhaskell.pdf
  2. --
@package DSH @version 0.5 -- | This module provides the reference implementation of DSH by -- interpreting the embedded representation. module Database.DSH.Interpreter fromQ :: (QA a, IConnection conn) => conn -> Q a -> IO a -- | DSH compiler module exposes the function fromQ that can be used to -- execute DSH programs on a database. It transform the DSH program into -- FerryCore which is then translated into SQL (through a table algebra). -- The SQL code is executed on the database and then processed to form a -- Haskell value. module Database.DSH.Compiler -- | Execute the query on the database fromQ :: (QA a, IConnection conn) => conn -> Q a -> IO a -- | Convert the query into unoptimised algebraic plan debugPlan :: (QA a, IConnection conn) => conn -> Q a -> IO String debugCore :: (QA a, IConnection conn) => conn -> Q a -> IO String -- | Convert the query into optimised algebraic plan debugPlanOpt :: (QA a, IConnection conn) => conn -> Q a -> IO String -- | Convert the query into SQL debugSQL :: (QA a, IConnection conn) => conn -> Q a -> IO String -- | This module is intended to be imported qualified, to avoid -- name clashes with Prelude functions. For example: -- --
--   import qualified Database.DSH as Q
--   import Database.DSH (Q)
--   
-- -- Alternatively you can hide Prelude and import this module like -- this: -- --
--   import Prelude ()
--   import Database.DSH
--   
-- -- In this case you still get Prelude definitions that are not provided -- by Database.DSH. module Database.DSH unit :: Q () false :: Q Bool true :: Q Bool not :: Q Bool -> Q Bool (&&) :: Q Bool -> Q Bool -> Q Bool (||) :: Q Bool -> Q Bool -> Q Bool eq :: (Eq a, QA a) => Q a -> Q a -> Q Bool (==) :: (Eq a, QA a) => Q a -> Q a -> Q Bool neq :: (Eq a, QA a) => Q a -> Q a -> Q Bool (/=) :: (Eq a, QA a) => Q a -> Q a -> Q Bool lt :: (Ord a, QA a) => Q a -> Q a -> Q Bool (<) :: (Ord a, QA a) => Q a -> Q a -> Q Bool lte :: (Ord a, QA a) => Q a -> Q a -> Q Bool (<=) :: (Ord a, QA a) => Q a -> Q a -> Q Bool gte :: (Ord a, QA a) => Q a -> Q a -> Q Bool (>=) :: (Ord a, QA a) => Q a -> Q a -> Q Bool gt :: (Ord a, QA a) => Q a -> Q a -> Q Bool (>) :: (Ord a, QA a) => Q a -> Q a -> Q Bool min :: (Ord a, QA a) => Q a -> Q a -> Q a max :: (Ord a, QA a) => Q a -> Q a -> Q a -- | Boolean fold | It's first argument is used in the case of False | It's -- second argument is used in the case of True | The third argument is -- the boolean bool :: QA a => Q a -> Q a -> Q Bool -> Q a cond :: QA a => Q Bool -> Q a -> Q a -> Q a (?) :: QA a => Q Bool -> (Q a, Q a) -> Q a nil :: QA a => Q [a] empty :: QA a => Q [a] cons :: QA a => Q a -> Q [a] -> Q [a] (<|) :: QA a => Q a -> Q [a] -> Q [a] snoc :: QA a => Q [a] -> Q a -> Q [a] (|>) :: QA a => Q [a] -> Q a -> Q [a] singleton :: QA a => Q a -> Q [a] head :: QA a => Q [a] -> Q a tail :: QA a => Q [a] -> Q [a] take :: QA a => Q Integer -> Q [a] -> Q [a] drop :: QA a => Q Integer -> Q [a] -> Q [a] map :: (QA a, QA b) => (Q a -> Q b) -> Q [a] -> Q [b] append :: QA a => Q [a] -> Q [a] -> Q [a] (><) :: QA a => Q [a] -> Q [a] -> Q [a] filter :: QA a => (Q a -> Q Bool) -> Q [a] -> Q [a] groupWith :: (Ord b, QA a, QA b) => (Q a -> Q b) -> Q [a] -> Q [[a]] sortWith :: (Ord b, QA a, QA b) => (Q a -> Q b) -> Q [a] -> Q [a] the :: (Eq a, QA a) => Q [a] -> Q a last :: QA a => Q [a] -> Q a init :: QA a => Q [a] -> Q [a] null :: QA a => Q [a] -> Q Bool length :: QA a => Q [a] -> Q Integer index :: QA a => Q [a] -> Q Integer -> Q a (!!) :: QA a => Q [a] -> Q Integer -> Q a reverse :: QA a => Q [a] -> Q [a] and :: Q [Bool] -> Q Bool or :: Q [Bool] -> Q Bool any :: QA a => (Q a -> Q Bool) -> Q [a] -> Q Bool all :: QA a => (Q a -> Q Bool) -> Q [a] -> Q Bool sum :: (QA a, Num a) => Q [a] -> Q a concat :: QA a => Q [[a]] -> Q [a] concatMap :: (QA a, QA b) => (Q a -> Q [b]) -> Q [a] -> Q [b] maximum :: (QA a, Ord a) => Q [a] -> Q a minimum :: (QA a, Ord a) => Q [a] -> Q a splitAt :: QA a => Q Integer -> Q [a] -> Q ([a], [a]) takeWhile :: QA a => (Q a -> Q Bool) -> Q [a] -> Q [a] dropWhile :: QA a => (Q a -> Q Bool) -> Q [a] -> Q [a] span :: QA a => (Q a -> Q Bool) -> Q [a] -> Q ([a], [a]) break :: QA a => (Q a -> Q Bool) -> Q [a] -> Q ([a], [a]) elem :: (Eq a, QA a) => Q a -> Q [a] -> Q Bool notElem :: (Eq a, QA a) => Q a -> Q [a] -> Q Bool zip :: (QA a, QA b) => Q [a] -> Q [b] -> Q [(a, b)] zipWith :: (QA a, QA b, QA c) => (Q a -> Q b -> Q c) -> Q [a] -> Q [b] -> Q [c] unzip :: (QA a, QA b) => Q [(a, b)] -> Q ([a], [b]) nub :: (Eq a, QA a) => Q [a] -> Q [a] fst :: (QA a, QA b) => Q (a, b) -> Q a snd :: (QA a, QA b) => Q (a, b) -> Q b integerToDouble :: Q Integer -> Q Double toQ :: QA a => a -> Q a data Q a class QA a class QA a => TA a table :: TA a => String -> Q [a] tableDB :: TA a => String -> Q [a] tableCSV :: TA a => String -> Q [a] tableWithKeys :: TA a => String -> [[String]] -> Q [a] class BasicType a class View a b | a -> b, b -> a view :: View a b => a -> b fromView :: View a b => b -> a tuple :: View a b => b -> a record :: View a b => b -> a qc :: QuasiQuoter -- | Lookup a database table, create corresponding Haskell record data -- types and generate QA and View instances -- -- Example usage: -- --
--   $(generateRecords myConnection "users" "User" [''Show,''Eq])
--   
-- -- Note that the da is created at compile time, not at run time! generateRecords :: IConnection conn => (IO conn) -> String -> String -> [Name] -> Q [Dec] -- | Derive QA and View instances for record definitions -- -- Example usage: -- --
--   $(generateInstances [d|
--   
--       data User = User
--           { userId    :: Int
--           , userName  :: String
--           }
--   
--     |])
--   
-- -- This generates the following record type, which can be used in view -- patterns -- --
--   data UserV = UserV
--       { userIdV    :: Q Int
--       , userNameV  :: Q String
--       }
--   
-- --
--   instance View (Q User) UserV
--   
-- -- and the liftet record selectors: -- --
--   userIdQ      :: Q User -> Q Int
--   userNameQ    :: Q User -> Q String
--   
generateInstances :: Q [Dec] -> Q [Dec] csvImport :: FilePath -> Type -> IO Norm csvExport :: TA a => FilePath -> [a] -> IO ()