yeshql: YesQL-style SQL database abstraction

[ database, library, mit ] [ Propose Tags ]

Use quasi-quotations or TemplateHaskell to write SQL in SQL, while adding type annotations to turn SQL into well-typed Haskell functions.

[Skip to Readme]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Versions [RSS],,,,,,,,,,,,,,,,,,,
Dependencies base (>=4.6 && <5.0), containers (>=0.5 && <1.0), convertible (>= && <2), filepath, HDBC (>=2.4 && <3.0), parsec (>=3.0 && <4.0), syb-with-class (>= && <1), template-haskell [details]
License MIT
Copyright 2015-2016 Tobias Dammers
Author Tobias Dammers
Category Database
Uploaded by TobiasDammers at 2017-03-27T07:37:27Z
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 11122 total (24 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-03-27 [all 1 reports]

Readme for yeshql-

[back to package description]


YesQL-style SQL database abstraction.

YeshQL implements quasiquoters that allow the programmer to write SQL queries in SQL, and embed these into Haskell programs using quasi-quotation. YeshQL takes care of generating suitable functions that will run the SQL queries against a HDBC database driver, and marshal values between Haskell and SQL.

In order to do this properly, YeshQL extends SQL syntax with type annotations and function names; other than that, it is perfectly ignorant about the SQL syntax itself. See the YesQL Readme for the full rationale - Haskell and Clojure are sufficiently different languages, but the reasoning behind YesQL applies to YeshQL almost unchanged.


Use stack or cabal to install. Nothing extraordinary here.


In short:

{-#LANGUAGE QuasiQuotes #-}
import MyProject.DatabaseConnection (withDB)
import Database.HDBC
import Database.YeshQL

  -- name:getUser :: (String)
  -- :userID :: Int
  SELECT username FROM users WHERE id = :userID

main = withDB $ \conn -> do
  username <- getUser 1 conn
  putStrLn username

Please refer to the Haddock documentation for further usage details.


Probably. The project is hosted at, feel free to comment there or send a message to if you find any.

Something about the name

YeshQL is rather heavily inspired by YesQL, so it makes sense to blatantly steal most of the name. Throwing in an "H" for good measure (this being Haskell and all) makes it sound like Sean Connery, which automatically increases aweshomenesh, so that'sh what we'll roll with.

License / Copying

YeshQL is Free Software and provided as-is. Please see the enclosed LICENSE file for details.