opaleye- An SQL-generating DSL targeting PostgreSQL

Safe HaskellNone




newtype Unpackspec columns columns' Source


Unpackspec (PackMap PrimExpr PrimExpr columns columns')

An Unpackspec columns columns' allows you to extract and modify a sequence of PrimExprs inside a value of type columns.

For example, the Default instance of type Unpackspec (Column a, Column b) (Column a, Column b) allows you to manipulate or extract the two PrimExprs inside a (Column a, Column b). The Default instance of type Foo (Column a) (Column b) (Column c) will allow you to manipulate or extract the three PrimExprs contained therein (for a user-defined product type Foo, assuming the makeAdaptorAndInstance splice from Data.Profunctor.Product.TH has been run).

You can create Unpackspecs by hand using unpackspecColumn and the Profunctor, ProductProfunctor and SumProfunctor operations. However, in practice users should almost never need to create or manipulate them. Typically they will be created automatically by the Default instance.

unpackspecColumn :: Unpackspec (Column a) (Column a) Source

Target the single PrimExpr inside a Column

runUnpackspec :: Applicative f => Unpackspec columns b -> (PrimExpr -> f PrimExpr) -> columns -> f b Source

Modify all the targeted PrimExprs

collectPEs :: Unpackspec s t -> s -> [PrimExpr] Source

Extract all the targeted PrimExprs