HORIZON HASKELLDocslts/ghc-10.0.x8c2f8e82026-10-19Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8c2f8e8 · 2026-10-19

Moduleopaleye-0.10.8.0Haskell2010

Opaleye.Internal.Table

  • 5 types
  • 1 class
  • 15 values
  • Packageopaleye-0.10.8.0
  • Exports21
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceTable.hs
datadata Table writeFields viewFields
#

Define a table as follows, where "id", "color", "location", "quantity" and "radius" are the table's fields in Postgres and the types are given in the type signature. The id field is an autoincrementing field (i.e. optional for writes).

data Widget a b c d e = Widget { wid      :: a
                               , color    :: b
                               , location :: c
                               , quantity :: d
                               , radius   :: e }

$(makeAdaptorAndInstanceInferrable "pWidget" ''Widget)

widgetTable :: Table (Widget (Maybe (Field SqlInt4)) (Field SqlText) (Field SqlText)
                             (Field SqlInt4) (Field SqlFloat8))
                     (Widget (Field SqlInt4) (Field SqlText) (Field SqlText)
                             (Field SqlInt4) (Field SqlFloat8))
widgetTable = table "widgetTable"
                     (pWidget Widget { wid      = tableField "id"
                                     , color    = tableField "color"
                                     , location = tableField "location"
                                     , quantity = tableField "quantity"
                                     , radius   = tableField "radius" })

Constructors

Instances2Profunctor, Functor
  • Profunctor TableDefined in opaleye-0.10.8.0 · Opaleye.Internal.Table
  • Functor (Table a)Defined in opaleye-0.10.8.0 · Opaleye.Internal.Table
datadata TableFields writeColumns viewColumns
#

Constructors

Instances4Profunctor, ProductProfunctor, Functor, Applicative
newtypenewtype View columns
#

Constructors

newtypenewtype Writer columns dummy
#

Constructors

Instances4Profunctor, ProductProfunctor, Functor, Applicative

optionalTableField is for fields that you can be set to DEFAULT on writes, such as fields which have defaults or which are SERIAL. Setting the write value to Nothing uses SQL DEFAULT in the generated update.

classclass InferrableTableField w (n :: Nullability) r | w -> n, w -> r where
#

You should not define your own instances of InferrableTableField.

Methods

Instances2InferrableTableField
  • InferrableTableField (Maybe (Field_ n r)) n rDefined in opaleye-0.10.8.0 · Opaleye.Internal.Table

    Equivalent to defining the column with optionalTableField. If the write type is Maybe (Field_ n r) (i.e. DEFAULT can be written to it) then the write type is Field_ n r.

  • InferrableTableField (Field_ n r) n rDefined in opaleye-0.10.8.0 · Opaleye.Internal.Table

    Equivalent to defining the column with requiredTableField. If the write type is Field_ n r then the read type is also Field_ n r.

newtypenewtype Zip a
#

Constructors

Instances2Semigroup, Monoid
  • Semigroup (Zip a)Defined in opaleye-0.10.8.0 · Opaleye.Internal.Table
  • Monoid (Zip a)Defined in opaleye-0.10.8.0 · Opaleye.Internal.Table