2

I know it can be done, but I'm having trouble getting it working. I'm still finding my feet with Haskell.

I tried using postgresql-typed, but it wouldn't compile. They don't enable the QuasiQuotes extension, so I don't understand how their code would ever compile. It also fails with an error on the useTPGDatabase statement. I cloned the library's source code from Github, but their tests failed to compile using stack with exactly the same errors.

I considered using hasql-th, but it's not on stackage.org, which immediately puts it in the "too hard basket.". I considered switching to nix but that seems like even more effort.

Does somebody have a reliable recipe for getting an environment working that type-checks SQL at compile time in Haskell?

mikevdg
  • 370
  • 1
  • 7

1 Answers1

3

I considered using hasql-th, but it's not on stackage.org, which immediately puts it in the "too hard basket."

All you need to do is add the latest version of hasql-th to the extra-deps section of your stack.yaml file and all other deps that Stack will suggest to you when you build.

In the end your stack.yaml file should look something like this:

resolver: lts-17.9
extra-deps:
  - hasql-th-0.4.0.8
  - headed-megaparsec-0.1.0.4
  - postgresql-syntax-0.3.0.3

Anticipating a question in the spirit of "Why is it not listed on Stackage?" It's just that nobody has gotten to list these packages yet.

Nikita Volkov
  • 42,792
  • 11
  • 94
  • 169