HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Moduleselda-0.5.2.1Haskell2010

Database.Selda.MakeSelectors

Utilities for creating selectors for non-record types. In general, you should really use record types for your tables and their record labels (i.e. #label) as selectors using the OverloadedLabels extension instead.

Synopsis
  • Packageselda-0.5.2.1
  • Exports4
  • LanguageHaskell2010
  • LicenceMIT
  • SourceMakeSelectors.hs
typetype Selectors r = Sels r (Rep r)

An inductive tuple of selectors for the given relation.

classclass GSelectors t (f :: Type -> Type) where

Any table type that can have selectors generated.

Instances4GSelectors
valueselectors :: (Relational a, GSelectors a (Rep a)) => Table a -> Selectors a

Generate selector functions for the given table. Selectors can be used to access the fields of a query result tuple, avoiding the need to pattern match on the entire tuple.

tbl :: Table (Int, Text)
tbl = table "foo" []
(tblBar :*: tblBaz) = selectors tbl

q :: Query s Text
q = do
  row <- select tbl
  return (row ! tblBaz)