{"id":16335764,"url":"https://github.com/3noch/postgresql-simple-interpolate","last_synced_at":"2025-10-26T13:34:07.399Z","repository":{"id":46029095,"uuid":"202934838","full_name":"3noch/postgresql-simple-interpolate","owner":"3noch","description":"Safe interpolated SQL queries in Haskell","archived":false,"fork":false,"pushed_at":"2023-06-16T15:20:01.000Z","size":22,"stargazers_count":11,"open_issues_count":2,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-09-29T20:21:36.320Z","etag":null,"topics":["haskell","interpolation","postgresql","postgresql-database","quasiquoter","template-haskell"],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/3noch.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-17T21:58:41.000Z","updated_at":"2023-11-28T22:05:03.000Z","dependencies_parsed_at":"2024-10-28T15:37:56.178Z","dependency_job_id":null,"html_url":"https://github.com/3noch/postgresql-simple-interpolate","commit_stats":{"total_commits":13,"total_committers":3,"mean_commits":4.333333333333333,"dds":"0.23076923076923073","last_synced_commit":"7a760ccf9bb4215abfc446d496f14c1f5a704ee7"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/3noch/postgresql-simple-interpolate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3noch%2Fpostgresql-simple-interpolate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3noch%2Fpostgresql-simple-interpolate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3noch%2Fpostgresql-simple-interpolate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3noch%2Fpostgresql-simple-interpolate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/3noch","download_url":"https://codeload.github.com/3noch/postgresql-simple-interpolate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3noch%2Fpostgresql-simple-interpolate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281114816,"owners_count":26446038,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-26T02:00:06.575Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["haskell","interpolation","postgresql","postgresql-database","quasiquoter","template-haskell"],"created_at":"2024-10-10T23:42:19.942Z","updated_at":"2025-10-26T13:34:07.364Z","avatar_url":"https://github.com/3noch.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `postgresql-simple-interpolate`\n\nWrite natural SQL statements in Haskell using a QuasiQuotes!\n\n```haskell\n{-# LANGUAGE QuasiQuotes #-}\n\nimport Data.Char (toLower)\nimport qualified Database.PostgreSQL.Simple as Pg\nimport Database.PostgreSQL.Simple.SqlQQ.Interpolated (isql)\nimport Control.Exception (bracket)\n\nmain :: IO ()\nmain = do\n  bracket (Pg.connectPostgreSQL \"host=localhost\") Pg.close $ \\conn -\u003e do\n    let limit = 10\n    ages \u003c- uncurry (query conn) [isql|SELECT age FROM table WHERE name = ${map toLower \"CLIVE\"} LIMIT ${limit}|]\n    print (ages :: [Pg.Only Int])\n|]\n```\n\n## Hacking\n\nWith Nix you can quickly play around with this using a PostgreSQL database:\n\n```\nnix-shell -p '(import ./. {}).haskellPackages.ghcWithPackages (p: [p.gargoyle-postgresql-connect p.postgresql-simple-interpolate])' --run ghci\n```\n\nThen run\n\n```haskell\n:set -XQuasiQuotes\nimport Gargoyle.PostgreSQL.Connect (withDb)\nimport Data.Pool (withResource)\nimport Database.PostgreSQL.Simple (Only (..), query)\nimport Database.PostgreSQL.Simple.SqlQQ.Interpolated (isql)\n[isql|SELECT ${1 + 1}|]\n-- (\"SELECT ?\",[Plain \"2\"])\nwithDb \"db\" $ \\pool -\u003e withResource pool $ \\c -\u003e (uncurry (query c) [isql|SELECT ${1 + 1}, ${reverse \"HELLO\"}::text|] :: IO [(Int, String)])\n-- [(2,\"OLLEH\")]\n```\n\n\n## Acknowledgements\n\nThis library is basically just a copy of the [`here` package](https://github.com/tmhedberg/here) by Taylor M. Hedberg with slight modifications!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3noch%2Fpostgresql-simple-interpolate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F3noch%2Fpostgresql-simple-interpolate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3noch%2Fpostgresql-simple-interpolate/lists"}