koldfront

Documentation of Haskell libraries #haskell #lantern

🕧︎ - 2021-10-09

While I was improving Lantern I wanted to use the Haskell library Database.PostgreSQL.Simple.Notification to monitor update search index events.

I was a little confused when I read the documentation of getNotification and saw that it didn't take what channel to listen on as an argument - having just read the PostgreSQL documentation of NOTIFY channel + LISTEN channel that was what I was expecting.

After some digging I found a test for the library and from that saw that the way to use D.P.S.Notification is to execute one or more LISTEN channel before calling getNotification.

In hindsight it is obvious (you want to be able to listen to multiple channels in the same getNotification call), but to me, as a relative beginner in Haskell and using postgresql-simple, and never having tried LISTEN/NOTIFY before, it wasn't.

I have written to the maintainer and suggested that the documentation of D.P.S.Notification mention this.

One thing I miss in the documentation of many Haskell libraries is a couple of lines giving an example of how to use them - luckily I found the solution in a test this time.

Add comment

How to in excruciating detail…

To avoid spam many websites make you fill out a CAPTCHA, or log in via an account at a corporation such as Twitter, Facebook, Google or even Microsoft GitHub.

I have chosen to use a more old school method of spam prevention.

To post a comment here, you need to:

  • Configure a newsreader¹ to connect to the server koldfront.dk on port 1119 using nntps (nntp over TLS).
  • Open the newsgroup called lantern.koldfront and post a follow up to the article.
¹ Such as Thunderbird, Pan, slrn, tin or Gnus (part of Emacs).

Or, you can fill in this form:

+=