DSH 0.4.2.1 → 0.4.3
raw patch · 5 files changed
+15/−15 lines, 5 filesdep ~Pathfinder
Dependency ranges changed: Pathfinder
Files
- DSH.cabal +2/−2
- src/Database/DSH/Compile.hs +2/−2
- src/Database/DSH/Compiler.hs +7/−9
- src/Database/DSH/Interpreter.hs +3/−1
- tests/Main.hs +1/−1
DSH.cabal view
@@ -1,5 +1,5 @@ Name: DSH-Version: 0.4.2.1+Version: 0.4.3 Synopsis: Database Supported Haskell Description: This is a Haskell library for database-supported program execution. Using@@ -65,7 +65,7 @@ syntax-trees >= 0.1.2, HaXml >= 1.20, csv >= 0.1,- Pathfinder >= 0.4,+ Pathfinder >= 0.5, FerryCore >= 0.4 Hs-Source-Dirs: src
src/Database/DSH/Compile.hs view
@@ -55,7 +55,7 @@ algToAlg :: AlgebraXML a -> IO (AlgebraXML a) algToAlg (Algebra s) = do- r <- compileFerryOpt s OutputXml Nothing+ r <- pathfinder s [] OutputXml case r of (Right sql) -> return $ Algebra sql (Left err) -> error $ "Pathfinder compilation for input: \n"@@ -65,7 +65,7 @@ -- | Translate an algebraic plan into SQL code using Pathfinder algToSQL :: AlgebraXML a -> IO (SQLXML a) algToSQL (Algebra s) = do- r <- compileFerryOpt s OutputSql Nothing+ r <- pathfinder s [] OutputSql case r of (Right sql) -> return $ SQL sql (Left err) -> error $ "Pathfinder compilation for input: \n"
src/Database/DSH/Compiler.hs view
@@ -1,8 +1,7 @@-{- | 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.--}+-- | 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. {-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, ScopedTypeVariables #-} @@ -76,17 +75,16 @@ -- * Convert DB queries into Haskell values --- | Similar to fromQ, gets as an extra argument a boolean determining whether --- debugging is switched on+-- | Execute the query on the database fromQ :: (QA a, IConnection conn) => conn -> Q a -> IO a fromQ c a = evaluate c a >>= (return . fromNorm) --- | Convert the query in an unoptimized algebraic plan.+-- | Convert the query into unoptimised algebraic plan debugPlan :: (QA a, IConnection conn) => conn -> Q a -> IO String debugPlan = doCompile --- | Convert the query in an optimized algebraic plan+-- | Convert the query into optimised algebraic plan debugPlanOpt :: (QA a, IConnection conn) => conn -> Q a -> IO String debugPlanOpt q c = do p <- doCompile q c
src/Database/DSH/Interpreter.hs view
@@ -1,3 +1,6 @@+-- | This module provides the reference implementation of DSH by interpreting+-- the embedded representation.+ {-# LANGUAGE TemplateHaskell, ViewPatterns, ScopedTypeVariables #-} {-# OPTIONS_GHC -fno-warn-incomplete-patterns #-} @@ -12,7 +15,6 @@ import GHC.Exts import Data.List --- * Convert DB queries into Haskell values fromQ :: (QA a, IConnection conn) => conn -> Q a -> IO a fromQ c (Q a) = evaluate c a >>= (return . fromNorm)
tests/Main.hs view
@@ -29,7 +29,7 @@ getConn = connectPostgreSQL "user = 'postgres' password = 'haskell98' host = 'localhost' dbname = 'ferry'" qc:: Testable prop => prop -> IO ()-qc = quickCheckWith stdArgs{maxSuccess = 20, maxSize = 10}+qc = quickCheckWith stdArgs{maxSuccess = 10, maxSize = 10} main :: IO () main = do