Skip to content

Latest commit

 

History

History
32 lines (24 loc) · 1.01 KB

notes.org

File metadata and controls

32 lines (24 loc) · 1.01 KB

Notes

Postgres (psql)

  • CREATE DATABASE dbname (OWNER name);
  • \c(onnect) dbname
  • \i some/script.sql

Opaleye

Type of runInsertReturning is:

runInsertReturning :: Default QueryRunner returned haskells =>
                      Connection ->
                      Table columnsW columnsR ->
                      columnsW ->
                      (columnsR -> returned) ->
                      IO [haskells]

You have to write out the type of IO [haskells] (whether that be Int, UUID, whatever) so that the function can return a concrete type, otherwise it doesn’t know what to return.

[haskells] is the type var for what is returning… deckId is an Int, so therefore we have IO [Int] as the return type.

returned and haskells are constrained by the same typeclass, as they are representing the same exact ‘thing’ being returned.

Servant