yeshql-core: YesQL-style SQL database abstraction (core)

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

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]

Properties

Versions 4.1.0.0, 4.1.0.1, 4.1.0.2, 4.1.0.2, 4.1.1.2, 4.2.0.0
Change log None available
Dependencies base (>=4.6 && <5.0), containers (>=0.5 && <1.0), convertible (>=1.1.1.0 && <2), filepath, parsec (>=3.0 && <4.0), template-haskell [details]
License MIT
Copyright 2015-2017 Tobias Dammers and contributors
Author Tobias Dammers
Maintainer tdammers@gmail.com
Category Database
Home page https://github.com/tdammers/yeshql
Bug tracker https://github.com/tdammers/yeshql/issues
Source repo head: git clone https://github.com/tdammers/yeshql.git
Uploaded by TobiasDammers at 2018-10-14T19:33:15Z

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for yeshql-core-4.1.0.2

[back to package description]

YeshQL

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.

Installation

Use stack or cabal to install. Nothing extraordinary here.

Usage

In short:

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

[yesh|
  -- 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.

Bugs

Probably. The project is hosted at https://github.com/tdammers/yeshql, feel free to comment there or send a message to tdammers@gmail.com 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.