https://wiki.haskell.org/index.php?title=Applications_and_libraries/Database_interfaces/HaskellDB/Archive&feed=atom&action=history
Applications and libraries/Database interfaces/HaskellDB/Archive - Revision history
2024-03-28T10:45:27Z
Revision history for this page on the wiki
MediaWiki 1.35.5
https://wiki.haskell.org/index.php?title=Applications_and_libraries/Database_interfaces/HaskellDB/Archive&diff=36612&oldid=prev
M4dc4p at 15:22, 31 August 2010
2010-08-31T15:22:00Z
<p></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 15:22, 31 August 2010</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td>
</tr>
<tr>
<td class="diff-marker"> </td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== THIS PAGE CONTAINS OUTDATED AND INACCURATE INFORMATION. ==</div></td>
<td class="diff-marker"> </td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== THIS PAGE CONTAINS OUTDATED AND INACCURATE INFORMATION. ==</div></td>
</tr>
<tr>
<td class="diff-marker"> </td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td>
<td class="diff-marker"> </td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td>
</tr>
<tr>
<td class="diff-marker">−</td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>This page exists for archival purposes only. Current information can be found on .</div></td>
<td class="diff-marker">+</td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>This page exists for archival purposes only. Current information can be found on <ins class="diffchange diffchange-inline">[[Applications and libraries/Database interfaces/HaskellDB]]</ins>.</div></td>
</tr>
<tr>
<td class="diff-marker"> </td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td>
<td class="diff-marker"> </td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td>
</tr>
<tr>
<td class="diff-marker"> </td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[Category:Applications]]</div></td>
<td class="diff-marker"> </td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[Category:Applications]]</div></td>
</tr>
</table>
M4dc4p
https://wiki.haskell.org/index.php?title=Applications_and_libraries/Database_interfaces/HaskellDB/Archive&diff=36611&oldid=prev
M4dc4p at 15:21, 31 August 2010
2010-08-31T15:21:02Z
<p></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 15:21, 31 August 2010</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td>
</tr>
<tr>
<td colspan="2" class="diff-empty"> </td>
<td class="diff-marker">+</td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>== THIS PAGE CONTAINS OUTDATED AND INACCURATE INFORMATION. ==</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty"> </td>
<td class="diff-marker">+</td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"></td>
</tr>
<tr>
<td colspan="2" class="diff-empty"> </td>
<td class="diff-marker">+</td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>This page exists for archival purposes only. Current information can be found on .</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty"> </td>
<td class="diff-marker">+</td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"></td>
</tr>
<tr>
<td class="diff-marker"> </td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[Category:Applications]]</div></td>
<td class="diff-marker"> </td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[Category:Applications]]</div></td>
</tr>
<tr>
<td class="diff-marker"> </td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Introduction ==</div></td>
<td class="diff-marker"> </td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Introduction ==</div></td>
</tr>
</table>
M4dc4p
https://wiki.haskell.org/index.php?title=Applications_and_libraries/Database_interfaces/HaskellDB/Archive&diff=36607&oldid=prev
M4dc4p: ArchivedPage moved to Applications and libraries/Database interfaces/HaskellDB/Archive
2010-08-31T15:15:40Z
<p>ArchivedPage moved to Applications and libraries/Database interfaces/HaskellDB/Archive</p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 15:15, 31 August 2010</td>
</tr>
<!-- diff cache key wikidb_haskell:diff:wikidiff2:1.12:old-36605:rev-36607:1.10.0 -->
</table>
M4dc4p
https://wiki.haskell.org/index.php?title=Applications_and_libraries/Database_interfaces/HaskellDB/Archive&diff=36605&oldid=prev
M4dc4p at 15:14, 31 August 2010
2010-08-31T15:14:15Z
<p></p>
<p><b>New page</b></p><div>[[Category:Applications]]<br />
== Introduction ==<br />
<br />
A [[combinator]] library for declarative, type safe database management. A domain specific embedded language, containing the concept of [[extensible record]] and a special Query [[monad]] (among other powerful ideas, see [[#Related concepts]]).<br />
<br />
All the queries and operations are completely expressed within Haskell, no embedded (SQL) commands are needed.<br />
<br />
== Status ==<br />
<br />
HaskellDB, pulled from its repository, builds on GHC 6.10.1.<br />
<br />
Some of HaskellDB HDBC backends (ODBC and SQLite3 to be exact) have been updated to work with recent HDBC (2.1 as of this writing).<br />
<br />
This library is in need of some tender love and care. Drop a mail at HaskellDB mailing list if you're interested in improving code or documentation.<br />
<br />
== Homes ==<br />
<br />
=== Current Version ===<br />
The current repository is stored at code.haskell.org. <br />
There was a [http://www.haskell.org/pipermail/haskell-cafe/2008-December/051557.html complaint on Haskell-cafe] that HaskellDB does not compile with GHC 6.10.1. This is only partially true: one can darcs get HaskellDB repository and build it themselves.<br />
<br />
The following procedure worked as of October, 2008:<br />
* GHC 6.8.3<br />
* Cabal 1.6(?)<br />
* HDBC 1.1.5<br />
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HDBC<br />
runghc Setup.lhs configure<br />
runghc Setup.lhs build<br />
sudo runghc Setup.lhs install<br />
* HDBC.ODBC 1.1.4.4<br />
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HDBC-odbc<br />
runghc Setup.hs configure<br />
runghc Setup.hs build<br />
sudo runghc Setup.hs install<br />
* HaskellDB - patch 743<br />
darcs get http://code.haskell.org/haskelldb<br />
runghc Setup.hs configure<br />
runghc Setup.hs build<br />
sudo runghc Setup.hs install<br />
cd driver-hdbc<br />
runghc Setup.hs configure<br />
runghc Setup.hs build<br />
sudo runghc Setup.hs install<br />
cd ../driver-hdbc-odbc<br />
runghc Setup.hs configure<br />
runghc Setup.hs build<br />
sudo runghc Setup.hs install<br />
<br />
=== [http://www.haskell.org/haskellDB/index.html Daan Leijen's original version] ===<br />
It makes possible to use Haskell's typecheck system for a type-safe, declarative database management -- a combinator library. It can prevent the user even from using multiple labels in the same record, but the price for this: it needs a special extension of Haskell called Trex (providing [[extensible record]]s).<br />
<br />
HaskellDB was originally developed by Daan Leijen, and is described in the paper Domain Specific Embedded Compilers, Daan Leijen and Erik Meijer. 2nd USENIX Conference on Domain-Specific Languages (DSL), Austin, USA, October 1999.<br />
<br />
=== [http://haskelldb.sourceforge.net Chalmers version] ===<br />
A student project by Björn Bringert, Anders Höckersten, Conny Andersson, Martin Andersson, Mary Bergman, Victor Blomqvist, Torbjörn Martin.<br />
<br />
It works well with the most common Haskell implementations, because [[extensible record]]s (without check for multiple labels) are implemented in a way which does not need the Trex extension of Haskell.<br />
<br />
See also Björn Bringert's slides [http://www.cs.chalmers.se/~bringert/publ/haskelldb/haskelldb-db-2005.pdf HaskellDB -- Type safe declarative database combinators].<br />
<br />
== Other materials ==<br />
<br />
=== How to use ===<br />
<br />
HaskellDB needs database schema expressed in Haskell to operate (not only a schema, but also some boilerplate, too: fortunately, it can be derived automagically). Furthermore, HaskellDB description and real database schema should be kept in sync.<br />
<br />
Here's an example of creating both database tables and appropriate Haskell boilerplate out of database specification.<br />
<br />
<haskell><br />
-- Compile with:<br />
-- ghc --make <filename><br />
---------------------------------<br />
-- Compile a Haskell description of a database (from a DBInfo)<br />
--<br />
import Database.HaskellDB<br />
import Database.HaskellDB.DBSpec.DBSpecToDBDirect<br />
import Database.HaskellDB.DBSpec<br />
import Database.HaskellDB.HDBC.ODBC<br />
import Database.HaskellDB.DBSpec.PPHelpers<br />
<br />
---------------------------------<br />
-- Connect to a DSN through ODBC<br />
withDB dsn = (connect driver) [ ("dsn",dsn) ]<br />
<br />
---------------------------------<br />
-- An example Database<br />
testdb = DBInfo {dbname = "test", opts = testopts, tbls = [testtbl1]}<br />
testopts = DBOptions {useBString = False, makeIdent = mkIdentPreserving}<br />
testtbl1 = TInfo {tname = "test_tbl", cols = [testcol11,testcol12]}<br />
testcol11 = CInfo {cname = "c11", descr = (IntT,False)}<br />
testcol12 = CInfo {cname = "c12", descr = (IntT,True)}<br />
<br />
---------------------------------<br />
main = do<br />
-- Generate the database type import files from the DBInfo structure<br />
dbInfoToModuleFiles "" "Test" testdb<br />
<br />
-- Create the database tables<br />
withDB "testdsn" $ \db -> dbSpecToDatabase db testdb<br />
</haskell><br />
<br />
Now we can express queries in a nice declarative and type-safe manner:<br />
<br />
<haskell><br />
-- Compile with:<br />
-- ghc --make <filename><br />
----------------------------------------------<br />
-- Query the database and print results<br />
--<br />
import Database.HaskellDB<br />
import Database.HaskellDB.DBSpec.DBSpecToDBDirect<br />
import Database.HaskellDB.DBSpec<br />
import Database.HaskellDB.HDBC.ODBC<br />
<br />
-- This file generated from "dbInfoToModuleFiles" function in Part 1.<br />
import Test.Test_tbl<br />
<br />
---------------------------------<br />
-- Connect to a DSN through ODBC<br />
withDB dsn = (connect driver) [ ("dsn",dsn) ]<br />
<br />
---------------------------------<br />
-- Get all the rows from the test table<br />
getSomeData :: Database -> IO [(Int,Maybe Int)]<br />
getSomeData db = do<br />
let q = do<br />
t <- table test_tbl<br />
order [desc t c11]<br />
return t<br />
rs <- query db q<br />
return $ map (\row -> (row!c11, row!c12)) rs<br />
<br />
---------------------------------<br />
main = do<br />
-- Query the database<br />
rs <- withDB "testdsn" $ \db -> getSomeData db<br />
mapM_ (putStrLn.(\(a,b) -> "(" ++ (show a) ++ "," ++ (show b) ++ ")")) rs<br />
</haskell><br />
<br />
For more examples, see [http://haskelldb.sourceforge.net/getting-started.html Getting Started] and [http://haskelldb.sourceforge.net/guide/ Guide to Hacking].<br />
<br />
=== ICS Wiki (FIXME: links seem broken) ===<br />
[http://abaris.zoo.cs.uu.nl:8080/wiki/ ICS Wiki] is a huge resource of Haskell materials (among others).<br />
* [http://abaris.zoo.cs.uu.nl:8080/wiki/pub/Afp/DomainSpecificLanguages/haskelldb.pdf Database programming with HaskellDB] -- a PDF file (slides). A webpage containing a link to it (among others): the bottom (attachment part) of [http://abaris.zoo.cs.uu.nl:8080/wiki/Afp/DomainSpecificLanguages the ''Domain Specific Languages'' page of ICS Wiki].<br />
* There are other links to HaskellDB materials in the [http://abaris.zoo.cs.uu.nl:8080/wiki/Afp/DomainSpecificLanguages#4_Haskell_DB HaskellDB section of the same page].<br />
<br />
=== Other ===<br />
* [http://www.vimeo.com/1983774 HaskellDB Talk Trailer]<br />
* [http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=8F1C49953E49974D927950052C15CA41?doi=10.1.1.26.6906&rep=rep1&type=pdf Original HaskellDB paper]<br />
<br />
== Future ==<br />
<br />
[http://homepages.cwi.nl/~ralf/HList/ HList --- a Haskell library for strongly typed heterogeneous collections] includes also extensible records. Its relatedness to database programming is described in the articles, see also its [http://hackage.haskell.org/trac/summer-of-code/ticket/33 possible] relatedness to HaskellDB project.<br />
<br />
To explore other declarative, type safe database managament approaches, see [[../CoddFish|CoddFish]]. Also it uses [http://homepages.cwi.nl/~ralf/HList/ HList].<br />
<br />
== Related concepts ==<br />
<br />
Concepts which are concerned by the papers of the two official HaskellDB homes<br />
* [[Extensible record]]<br />
* [[Phantom type]]<br />
* [[Generalised algebraic datatype]]<br />
* [[Relational algebra]]</div>
M4dc4p