Documentation of Haskell libraries #haskell #lantern
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 comment, 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 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
- Open the newsgroup called
¹ Such as Thunderbird, Pan, slrn, tin or Gnus (part of Emacs).koldfront.dkon port1119using nntps (nntp over TLS).lantern.koldfrontand post a follow up to the article.Or, you can fill in this form: