Readme for hssqlppp-0.2.0

Summary: A parser, pretty printer, and type checker for PostgreSQL SQL and PL/pgSQL. BSD licensed. The current aims of the project is to provide a parser and type checker for a substantial portion of PostgreSQL SQL and PL/pgSQL, and then hopefully to build on this to make tools and libraries to help developing PL/pgSQL code, possibly: macros/ code generation/ custom syntax, type safe access from Haskell, Lint-like checking, documentation generation. Status: it successfully parses and accurately pretty prints the three moderate sized SQL files from another project of mine, but there are lots of missing bits. Coverage of SQL is sort of reasonable - it's possible that your SQL files will parse OK, but it's also possible that they won't parse at all. Please report any SQL which doesn't parse. It also has the beginnings of a type checker, which currently can type check a fair bit of the three files mentioned above. You can run the type checker on your SQL in various ways from the command line. Please report any SQL which doesn't type check correctly. Coming soon: a command to produce a report on how well this code can parse and type check your SQL. It comes with a small test suite. To install, use cabal update then cabal install hssqlppp It's currently developed on GHC 6.12, but is tested on 6.10 before each release so should work there too. There isn't much in the way of documentation at the moment. See the haddock docs locally or on hackage (link below), which also contain links to a few example files. The source has a fair bit of comments, which are currently OK in some places and poor in others. The main dependencies of this project are: Parsec 3, HDBC, HDBC-postgresql, and UUAGC is needed only for development). You need PostgreSQL installed. ================================================================================ Homepage There isn't really a homepage or website yet, but you can view the Launchpad page where the code is hosted, and the HackageDB page. Launchpad: http://launchpad.net/hssqlppp/ HackageDB page: http://hackage.haskell.org/package/hssqlppp You can also browse the limited Haddock documentation online here. You can get the latest development code from Launchpad using Bazaar: bzr branch lp:~jakewheat/hssqlppp/trunk ================================================================================ Contact Let me know if you're using/ interesting in using the library, if you have any problems or suggestions, etc.. All contributions, comments and criticism welcome: jakewheatmail@gmail.com You can also report problems on the bug tracker on Launchpad. ================================================================================ Example files: (remove the prefix http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head%3A/ to get the local relative path) The test files for parsing and for type checking contain examples of what parses/ typechecks and what the asts and annotations look like: http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head%3A/Database/HsSqlPpp/Tests/ParserTests.lhs http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head%3A/Database/HsSqlPpp/Tests/TypeCheckTests.lhs The HsSqlSystem command source - HsSqlSystem.lhs. AST transform code to extend plpgsql without any custom syntax, for another project, early days: http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head%3A/Database/HsSqlPpp/Extensions/ChaosExtensions.lhs Some type safe database access rough example code, all just half finished demo ideas at the moment: Simple idea to work as a preprocess to parse a haskell file and convert some declarations into calls to a wrapper around HDBC, with the correct type signatures, with the return type as a list of haskell tuples: http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head%3A/Database/HsSqlPpp/Dbms/WrapperGen.lhs Similar to previous idea, but using template haskell to do the substitution at compile time, not as a preprocessor: http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head%3A/Database/HsSqlPpp/Dbms/DBAccess2.lhs example usage: http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head%3A/testfiles/DBAccess2Test.lhs Use template haskell again, but type the return values as lists of hlists instead of tuples, so that field names in haskell code are also checked at compile time: http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head%3A/Database/HsSqlPpp/Dbms/DBAccess3.lhs example usage: http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head%3A/testfiles/DBAccess3Test.lhs