A Type-Safe Database Query DSL for Scala

December 21st, 2008

When the topic of JDBC wrappers came up on the Scala mailing list a few weeks ago, I mentioned that…

I’d prefer a type-safe DSL for database queries but that’s more
complicated. I’m still experimenting with that, too :)

I think those experiments worked rather well and the code is now in a state where the major features are usable and I can show some example code which compiles and runs successfully as a proof of concept. Many features (like more SQL operators, more data types and column aliasing) are missing but at least I am confident that it is possible to implement them on this basis.

Just like HaskellDB and LINQ to SQL, I am using a query monad which collects the projections and restrictions on database tables in a composable way to build an SQL statement for a query while producing the correct type for that statement’s result in Scala’s type system. Don’t worry if that sounds too abstract, there will be plenty of example code. Read the rest of this entry »

Formal Language Processing in Scala, Solutions to Part 4

October 12th, 2008

Here is the solution to the exercise from part 4. Read the rest of this entry »

Formal Language Processing in Scala, Part 4

September 20th, 2008

This is the fourth part in a series of articles on formal language processing in Scala, focusing on parser combinators and language interpretation. I wanted to have this part out several weeks ago but setting up my new home file server (running OpenSolaris Indiana) kept me busy. I’ll save the details of that endeavour for another post. Read the rest of this entry »

Formal Language Processing in Scala, Solutions to Part 3

August 23rd, 2008

Here are the solutions to the exercises from part 3. Read the rest of this entry »

Formal Language Processing in Scala, Part 3

August 16th, 2008

This is the third part in a series of articles on formal language processing in Scala, focusing on parser combinators and language interpretation. In this part I will add a nice operator syntax and support for recursive grammars to the simple parser combinators introduced in part 2 and then move on to the parser combinators from Scala’s core library. Read the rest of this entry »


Close
E-mail It