packages feed

composite-opaleye 0.8.1.0 → 0.8.2.0

raw patch · 3 files changed

+13/−75 lines, 3 filesdep ~opaleyePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: opaleye

API changes (from Hackage documentation)

- Composite.Opaleye.ProductProfunctors: type family PRecCo p rs :: [*];
- Composite.Opaleye.RecordTable: instance Composite.Opaleye.RecordTable.DefaultRecTableField (GHC.Maybe.Maybe (Opaleye.Internal.Column.Field a)) (Opaleye.Internal.Column.Field a)
- Composite.Opaleye.RecordTable: instance Composite.Opaleye.RecordTable.DefaultRecTableField (Opaleye.Internal.Column.Field a) (Opaleye.Internal.Column.Field a)
+ Composite.Opaleye.ProductProfunctors: type PRecCo p rs :: [*];
+ Composite.Opaleye.ProductProfunctors: type PRecContra p rs :: [*];
+ Composite.Opaleye.RecordTable: instance Composite.Opaleye.RecordTable.DefaultRecTableField (GHC.Maybe.Maybe (Opaleye.Internal.Column.Field_ n a)) (Opaleye.Internal.Column.Field_ n a)
+ Composite.Opaleye.RecordTable: instance Composite.Opaleye.RecordTable.DefaultRecTableField (Opaleye.Internal.Column.Field_ n a) (Opaleye.Internal.Column.Field_ n a)

Files

composite-opaleye.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.5.+-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack  name:           composite-opaleye-version:        0.8.1.0+version:        0.8.2.0 synopsis:       Opaleye SQL for Vinyl records description:    Integration between Vinyl records and Opaleye SQL, allowing records to be stored, retrieved, and queried from PostgreSQL. category:       Records@@ -49,7 +49,7 @@     , bytestring >=0.10.8.1 && <0.12     , composite-base ==0.8.*     , lens >=4.15.4 && <5.2-    , opaleye >=0.5.4.0 && <0.10+    , opaleye >=0.9.0 && <0.10     , postgresql-simple >=0.5.3.0 && <0.7     , product-profunctors >=0.8.0.3 && <0.12     , profunctors >=5.2.1 && <5.7@@ -91,7 +91,7 @@     , composite-opaleye     , hspec     , lens >=4.15.4 && <5.2-    , opaleye >=0.5.4.0 && <0.10+    , opaleye >=0.9.0 && <0.10     , postgresql-simple >=0.5.3.0 && <0.7     , product-profunctors >=0.8.0.3 && <0.12     , profunctors >=5.2.1 && <5.7
src/Composite/Opaleye/RecordTable.hs view
@@ -8,15 +8,9 @@ import qualified Data.Profunctor.Product as PP import Data.Proxy (Proxy(Proxy)) import GHC.TypeLits (KnownSymbol, symbolVal)-#if MIN_VERSION_opaleye(0,8,0)-import Opaleye (Field, requiredTableField, optionalTableField)+import Opaleye (Field_, requiredTableField, optionalTableField) import Opaleye.Internal.Table (TableFields)-#else-import Opaleye (Column, required, optional)-import Opaleye.Internal.Table (TableProperties)-#endif -#if MIN_VERSION_opaleye(0,8,0) -- |Helper typeclass which picks which of 'requiredTableField' or 'optionalTableField' to use for a pair of write column type and read column type. -- -- @DefaultRecTableField (Maybe (Field a)) (Field a)@ uses 'optionalTableField'.@@ -24,27 +18,12 @@ class DefaultRecTableField write read where   defaultRecTableField :: String -> TableFields write read -instance DefaultRecTableField (Maybe (Field a)) (Field a) where+instance DefaultRecTableField (Maybe (Field_ n a)) (Field_ n a) where   defaultRecTableField = optionalTableField -instance DefaultRecTableField (Field a) (Field a) where+instance DefaultRecTableField (Field_ n a) (Field_ n a) where   defaultRecTableField = requiredTableField-#else--- |Helper typeclass which picks which of 'required' or 'optional' to use for a pair of write column type and read column type.------ @DefaultRecTableField (Maybe (Column a)) (Column a)@ uses 'optional'.--- @DefaultRecTableField        (Column a)  (Column a)@ uses 'required'.-class DefaultRecTableField write read where-  defaultRecTableField :: String -> TableProperties write read -instance DefaultRecTableField (Maybe (Column a)) (Column a) where-  defaultRecTableField = optional--instance DefaultRecTableField (Column a) (Column a) where-  defaultRecTableField = required-#endif--#if MIN_VERSION_opaleye(0,8,0) -- |Type class for producing a default 'TableFields' schema for some expected record types. 'requiredTableField' and 'optionalTableField' are chosen automatically and the -- column is named after the record fields. --@@ -84,44 +63,3 @@       step = defaultRecTableField $ symbolVal (Proxy :: Proxy s)       recur :: TableFields (Rec Identity writes) (Rec Identity reads)       recur = defaultRecTable-#else--- |Type class for producing a default 'TableProperties' schema for some expected record types. 'required' and 'optional' are chosen automatically and the--- column is named after the record fields.------ For example, given:------ >  type WriteRec = Record '["id" :-> Maybe (Column PGInt8), "name" :-> Column PGText]--- >  type ReadRec  = Record '["id" :->        Column PGInt8 , "name" :-> Column PGText]------ This:------ >  defaultRecTable :: TableProperties WriteRec ReadRec------ Is equivalent to:------ > pRec (optional "id" &: required "name" &: Nil)--------- Alternately, use 'Composite.Opaleye.ProductProfunctors.pRec' and the usual Opaleye 'required' and 'optional'.-class DefaultRecTable write read where-  defaultRecTable :: TableProperties (Rec Identity write) (Rec Identity read)--instance DefaultRecTable '[] '[] where-  defaultRecTable = dimap (const ()) (const RNil) PP.empty--instance-    forall s r reads w writes.-    ( KnownSymbol s-    , DefaultRecTableField w r-    , DefaultRecTable writes reads-    ) => DefaultRecTable (s :-> w ': writes) (s :-> r ': reads) where-  defaultRecTable =-    dimap (\ (Identity (Val w) :& writeRs) -> (w, writeRs))-          (\ (r, readRs) -> (Identity (Val r) :& readRs))-          (step  ***! recur)-    where-      step :: TableProperties w r-      step = defaultRecTableField $ symbolVal (Proxy :: Proxy s)-      recur :: TableProperties (Rec Identity writes) (Rec Identity reads)-      recur = defaultRecTable-#endif
src/Composite/Opaleye/TH.hs view
@@ -23,7 +23,7 @@   ) import Language.Haskell.TH.Syntax (lift) import Opaleye-  ( Column, DefaultFromField, ToFields, fromPGSFromField, defaultFromField+  ( DefaultFromField, Field, ToFields, fromPGSFromField, defaultFromField, toToFields   ) import Opaleye.Internal.PGTypes (IsSqlType, showSqlType, literalColumn) import Opaleye.Internal.HaskellDB.PrimQuery (Literal(StringLit))@@ -59,7 +59,7 @@ --     deriveOpaleyeEnum ''MyEnum "myschema.myenum" ('stripPrefix' "my" . 'map' 'toLower') -- @ ----- Will create @PGMyEnum@ and instances required to use @MyEnum@ / @Column MyEnum@ in Opaleye.+-- Will create @PGMyEnum@ and instances required to use @MyEnum@ / @Field MyEnum@ in Opaleye. -- -- The Haskell generated by this splice for the example is something like: --@@ -82,8 +82,8 @@ --     instance 'DefaultFromField' PGMyEnum MyEnum where --       defaultFromField = 'fromPGSFromField' -----     instance 'Default' 'ToFields' MyEnum ('Column' PGMyEnum) where---       def = 'ToFields' $ \ a ->+--     instance 'Default' 'ToFields' MyEnum ('Field' PGMyEnum) where+--       def = 'toToFields' $ \ a -> --         'literalColumn' . 'stringLit' $ case a of --           MyFoo -> "foo" --           MyBar -> "bar"@@ -180,7 +180,7 @@           []       ] -  defaultInst <- instanceD (cxt []) [t| Default ToFields $hsType (Column $sqlType) |] . (:[]) $ do+  defaultInst <- instanceD (cxt []) [t| Default ToFields $hsType (Field $sqlType) |] . (:[]) $ do     s <- newName "s"     let body = lamE [varP s] $           caseE (varE s) $@@ -193,7 +193,7 @@     funD 'def       [ clause           []-          (normalB [| ToFields (literalColumn . StringLit . $body) |])+          (normalB [| toToFields (literalColumn . StringLit . $body) |])           []       ]