Questions tagged [haskelldb]

HaskellDB is a Haskell library for expressing database queries and operations in a type safe and declarative way. HaskellDB compiles a relational algebra-like syntax into SQL, submits the operations to the database for processing, and returns the results as ordinary Haskell values.

HaskellDB is a Haskell library for expressing database queries and operations in a type safe and declarative way. HaskellDB compiles a relational algebra-like syntax into SQL, submits the operations to the database for processing, and returns the results as ordinary Haskell values.

It is available at http://hackage.haskell.org/package/haskelldb

HaskellDB was originally written by Daan Leijen and it's design 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 (http://www.usenix.org/events/dsl99/).

This new version of HaskellDB was produced as a student project at Chalmers University of Technology in Gothenburg, Sweden. The aim of the project was to make HaskellDB a practically useful database library. That work is described in Student Paper: HaskellDB Improved, Björn Bringert, Anders Höckersten, Conny Andersson, Martin Andersson, Mary Bergman, Victor Blomqvist and Torbjörn Martin. In Proceedings of the ACM SIGPLAN 2004 Haskell Workshop, Snowbird, Utah, USA, September 22, 2004. (http://haskelldb.sourceforge.net/haskelldb.pdf)

9 questions
49
votes
1 answer

How can I use HaskellDB with polymorphic fields? (Problems with overlapping instances)

I have a schema which has 6 different types of entities, but they all have a lot of things in common. I figured I could probably abstract a lot of this commonality out at the type level, but I've hit a problem with HaskellDB and overlapping…
ocharles
  • 6,172
  • 2
  • 35
  • 46
32
votes
4 answers

How do I create an operator in Haskell?

Making a ternary logic table, and I would like to make my own function for an operator that I'll call <=>. So, for example, I want to do this, but that isn't right. what's the correct way to do this? data Ternary = T | F | M deriving (Eq, Show,…
user1189352
  • 3,628
  • 12
  • 50
  • 90
12
votes
1 answer

Basic example of using HaskellDB to unmap records of a table

Suppose that I have the following (PostgreSQL) table definition: CREATE TABLE books ( id serial NOT NULL, title character varying NOT NULL, PRIMARY KEY (id) ); And the following record definition: data Book = { id :: Int , title…
Daniel Trebbien
  • 38,421
  • 18
  • 121
  • 193
3
votes
1 answer

HaskellDB - 'Database' variable is not in scope

I am trying to run this haskelldb hello world example, module Caturday.Model.Connect where import Database.HaskellDB.HDBC import Database.HaskellDB.Sql.PostgreSQL import Database.HDBC.PostgreSQL (connectPostgreSQL) withDB :: [(String,String)] ->…
user2879704
2
votes
1 answer

Datatypes with haskelldb in practice (Text, UTCTime)

I just started to look into haskelldb as a more powerful companion to persistent, as I need a more powerful tool to query the database. Almost immediately I ran into difficulties with datatypes; in particular, I am using Data.Text quite extensively,…
ondra
  • 9,122
  • 1
  • 25
  • 34
2
votes
1 answer

How do I specify a primary key on table creation with haskellDB?

Currently I am using something like this: dbCreateTable db "MyTable" [ ("Col1", (StringT, False)), ("Col2", (StringT, False)) ] which works fine, but i'd like to make "Col1" the primary key. Do i need to go back to raw SQL? edit: This still seems…
somesoaccount
  • 1,267
  • 15
  • 37
1
vote
1 answer

How do I use postgresqlConnect in the Database.HaskellDB.HDBC.PostgreSQL module?

I am not quite sure how to use the postgresqlConnect function in module Database.HaskellDB.HDBC.PostgreSQL to connect to a PostgreSQL database. The Haddock documentation page only states the type signature: postgresqlConnect :: MonadIO m =>…
Daniel Trebbien
  • 38,421
  • 18
  • 121
  • 193
1
vote
1 answer

Is there anyway to reverse engineer fields from existing schema using haskelldb or any other haskell library?

I'm looking to port some python scripts to haskell, the scripts use sqlalchemy(ORM) that lets you reverse engineer models from existing DB schema which is quite handy. I'm not sure if there's any library in haskell which lets you do the same thing.…
opensourcegeek
  • 5,552
  • 7
  • 43
  • 64
0
votes
1 answer

Build connection with HaskellDB.HDBC.Odbc

I'm new to Haskell. I've read most of LYAH and RWH and have also done some small programms. No I would like to use Haskell with an Oracle DB. I would like to use HaskellDB with HDBC.ODBC. I was able to connect to the DB via HDBC and run a query. But…
user3535953
  • 143
  • 6