[database-devel] ANNOUNCE: sqlite-simple 0.1.0.0: mid-level API to the sqlite database
jjhellst at gmail.com
Wed Aug 15 16:56:50 CEST 2012
sqlite-simple provides a convenient API to sqlite that performs
automatic data conversion between the database and Haskell types. The
API has been modeled directly after postgresql-simple which in turn
borrows from mysql-simple.
The library is available on hackage at
First create a test database..
sqlite3 test.db "CREATE TABLE test (id INTEGER PRIMARY KEY, str text);\
INSERT INTO test (str) VALUES ('test string');"
..and access it in Haskell:
data TestField = TestField Int String
instance FromRow TestField where
fromRow = TestField <$> field <*> field
main :: IO ()
main = do
conn <- open "test.db"
execute conn "INSERT INTO test (str) VALUES (?)"
(Only ("test string 2" :: String))
r <- query_ conn "SELECT * from test" :: IO [TestField]
mapM_ print r
A lot of the code is directly borrowed from mysql-simple by Bryan
O'Sullivan and from postgresql-simple by Leon P. Smith. Like Leon in
postgresql-simple, I've borrowed code and documentation directly from
both of these ancestor libraries.
This package builds on top of the direct-sqlite package by Irene
Thanks to all of the above for helpful comments, features and code
Bugs, feature requests?
I'm happy to receive bug reports via github on:
For discussion, I recommend the database-devel mailing list:
More information about the database-devel