HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulepostgresql-simple-0.7.0.0Haskell2010

Database.PostgreSQL.Simple.ToRow

The ToRow typeclass, for rendering a collection of parameters to a SQL query.

Predefined instances are provided for tuples containing up to ten elements.

  • 1 class
classclass ToRow a where
#

A collection type that can be turned into a list of rendering Actions.

Instances should use the toField method of the ToField class to perform conversion of each element of the collection.

You can derive ToRow for your data type using GHC generics, like this:

{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric  #-}

import GHC.Generics (Generic)
import Database.PostgreSQL.Simple (ToRow)

data User = User { name :: String, fileQuota :: Int }
  deriving (Generic, ToRow)

Note that this only works for product types (e.g. records) and does not support sum types or recursive types.

Methods

Instances23ToRow, …