packages feed

opaleye 0.7.6.2 → 0.8.0.0

raw patch · 39 files changed

+253/−616 lines, 39 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Opaleye: ToFields :: (haskells -> fields) -> ToFields haskells fields
- Opaleye: [constantExplicit] :: ToFields haskells fields -> haskells -> fields
- Opaleye: binaryspecMaybeFields :: WithNulls Binaryspec a b -> Binaryspec (MaybeFields a) (MaybeFields b)
- Opaleye: catMaybeFields :: SelectArr i (MaybeFields a) -> SelectArr i a
- Opaleye: class DefaultFromField sqlType haskellType
- Opaleye: constant :: Default ToFields haskells fields => haskells -> fields
- Opaleye: data Cursor haskells
- Opaleye: data FromField pgType haskellType
- Opaleye: data FromFields columns haskells
- Opaleye: data MaybeFields fields
- Opaleye: data Nullspec fields fields'
- Opaleye: defaultFromField :: DefaultFromField sqlType haskellType => FromField sqlType haskellType
- Opaleye: distinctspecMaybeFields :: WithNulls Distinctspec a b -> Distinctspec (MaybeFields a) (MaybeFields b)
- Opaleye: fromFieldsMaybeFields :: FromFields fields haskells -> FromFields (MaybeFields fields) (Maybe haskells)
- Opaleye: fromMaybeFields :: Default IfPP b b => b -> MaybeFields b -> b
- Opaleye: fromMaybeFieldsExplicit :: IfPP b b -> b -> MaybeFields b -> b
- Opaleye: fromPGSFieldParser :: FieldParser haskell -> FromField pgType haskell
- Opaleye: fromPGSFromField :: FromField haskell => FromField pgType haskell
- Opaleye: fullJoin :: (Default Unpackspec fieldsL fieldsL, Default Unpackspec fieldsR fieldsR, Default NullMaker fieldsL nullableFieldsL, Default NullMaker fieldsR nullableFieldsR) => Select fieldsL -> Select fieldsR -> ((fieldsL, fieldsR) -> Field SqlBool) -> Select (nullableFieldsL, nullableFieldsR)
- Opaleye: fullJoinExplicit :: Unpackspec fieldsL fieldsL -> Unpackspec fieldsR fieldsR -> NullMaker fieldsL nullableFieldsL -> NullMaker fieldsR nullableFieldsR -> Select fieldsL -> Select fieldsR -> ((fieldsL, fieldsR) -> Field SqlBool) -> Select (nullableFieldsL, nullableFieldsR)
- Opaleye: fullJoinInferrable :: (Default Unpackspec fieldsL fieldsL, Default Unpackspec fieldsR fieldsR, Default NullMaker fieldsL nullableFieldsL, Default NullMaker fieldsR nullableFieldsR, Map Nulled fieldsL ~ nullableFieldsL, Map Nulled fieldsR ~ nullableFieldsR) => Select fieldsL -> Select fieldsR -> ((fieldsL, fieldsR) -> Field SqlBool) -> Select (nullableFieldsL, nullableFieldsR)
- Opaleye: justFields :: a -> MaybeFields a
- Opaleye: leftJoin :: (Default Unpackspec fieldsL fieldsL, Default Unpackspec fieldsR fieldsR, Default NullMaker fieldsR nullableFieldsR) => Select fieldsL -> Select fieldsR -> ((fieldsL, fieldsR) -> Field SqlBool) -> Select (fieldsL, nullableFieldsR)
- Opaleye: leftJoinA :: (Default Unpackspec fieldsR fieldsR, Default NullMaker fieldsR nullableFieldsR) => Select fieldsR -> SelectArr (fieldsR -> Field SqlBool) nullableFieldsR
- Opaleye: leftJoinAExplict :: Unpackspec fieldsR fieldsR -> NullMaker fieldsR nullableFieldsR -> Select fieldsR -> SelectArr (fieldsR -> Field SqlBool) nullableFieldsR
- Opaleye: leftJoinExplicit :: Unpackspec fieldsL fieldsL -> Unpackspec fieldsR fieldsR -> NullMaker fieldsR nullableFieldsR -> Select fieldsL -> Select fieldsR -> ((fieldsL, fieldsR) -> Field SqlBool) -> Select (fieldsL, nullableFieldsR)
- Opaleye: leftJoinInferrable :: (Default Unpackspec fieldsL fieldsL, Default Unpackspec fieldsR fieldsR, Default NullMaker fieldsR nullableFieldsR, Map Nulled fieldsR ~ nullableFieldsR) => Select fieldsL -> Select fieldsR -> ((fieldsL, fieldsR) -> Field SqlBool) -> Select (fieldsL, nullableFieldsR)
- Opaleye: matchMaybe :: Default IfPP b b => MaybeFields a -> (Maybe a -> b) -> b
- Opaleye: maybeFields :: Default IfPP b b => b -> (a -> b) -> MaybeFields a -> b
- Opaleye: maybeFieldsExplicit :: IfPP b b' -> b -> (a -> b) -> MaybeFields a -> b'
- Opaleye: maybeFieldsToSelect :: SelectArr (MaybeFields a) a
- Opaleye: newtype ToFields haskells fields
- Opaleye: nothingFields :: Default Nullspec a a => MaybeFields a
- Opaleye: nothingFieldsExplicit :: Nullspec a b -> MaybeFields b
- Opaleye: nothingFieldsOfTypeOf :: a -> MaybeFields a
- Opaleye: nullspecEitherLeft :: Nullspec a b -> Nullspec a (Either b b')
- Opaleye: nullspecEitherRight :: Nullspec a b' -> Nullspec a (Either b b')
- Opaleye: nullspecField :: IsSqlType b => Nullspec a (Column b)
- Opaleye: nullspecList :: Nullspec a [b]
- Opaleye: nullspecMaybeFields :: Nullspec a b -> Nullspec (MaybeFields a) (MaybeFields b)
- Opaleye: optionalExplicit :: Unpackspec a a -> SelectArr i a -> SelectArr i (MaybeFields a)
- Opaleye: optionalRestrict :: Default Unpackspec a a => Select a -> SelectArr (a -> Field SqlBool) (MaybeFields a)
- Opaleye: optionalRestrictExplicit :: Unpackspec a a -> Select a -> SelectArr (a -> Field SqlBool) (MaybeFields a)
- Opaleye: rightJoin :: (Default Unpackspec fieldsL fieldsL, Default Unpackspec fieldsR fieldsR, Default NullMaker fieldsL nullableFieldsL) => Select fieldsL -> Select fieldsR -> ((fieldsL, fieldsR) -> Field SqlBool) -> Select (nullableFieldsL, fieldsR)
- Opaleye: rightJoinExplicit :: Unpackspec fieldsL fieldsL -> Unpackspec fieldsR fieldsR -> NullMaker fieldsL nullableFieldsL -> Select fieldsL -> Select fieldsR -> ((fieldsL, fieldsR) -> Field SqlBool) -> Select (nullableFieldsL, fieldsR)
- Opaleye: rightJoinInferrable :: (Default Unpackspec fieldsL fieldsL, Default Unpackspec fieldsR fieldsR, Default NullMaker fieldsL nullableFieldsL, Map Nulled fieldsL ~ nullableFieldsL) => Select fieldsL -> Select fieldsR -> ((fieldsL, fieldsR) -> Field SqlBool) -> Select (nullableFieldsL, fieldsR)
- Opaleye: runSelect :: Default FromFields fields haskells => Connection -> Select fields -> IO [haskells]
- Opaleye: runSelectExplicit :: FromFields fields haskells -> Connection -> Select fields -> IO [haskells]
- Opaleye: runSelectFold :: Default FromFields fields haskells => Connection -> Select fields -> b -> (b -> haskells -> IO b) -> IO b
- Opaleye: runSelectFoldExplicit :: FromFields fields haskells -> Connection -> Select fields -> b -> (b -> haskells -> IO b) -> IO b
- Opaleye: runSelectI :: Default (Inferrable FromFields) fields haskells => Connection -> Select fields -> IO [haskells]
- Opaleye: runSelectTF :: Default FromFields (rec O) (rec H) => Connection -> Select (rec O) -> IO [rec H]
- Opaleye: toFieldsMaybeFields :: Nullspec a b -> ToFields a b -> ToFields (Maybe a) (MaybeFields b)
- Opaleye: toToFields :: (haskells -> fields) -> ToFields haskells fields
- Opaleye: traverseMaybeFields :: (Default Unpackspec a a, Default Unpackspec b b) => SelectArr a b -> SelectArr (MaybeFields a) (MaybeFields b)
- Opaleye: traverseMaybeFieldsExplicit :: Unpackspec a a -> Unpackspec b b -> SelectArr a b -> SelectArr (MaybeFields a) (MaybeFields b)
- Opaleye: type Constant = ToFields
- Opaleye: unpackspecMaybeFields :: Unpackspec a b -> Unpackspec (MaybeFields a) (MaybeFields b)
- Opaleye: unsafeFromField :: (b -> b') -> FromField sqlType b -> FromField sqlType' b'
- Opaleye: valuesspecMaybeFields :: Valuesspec a b -> Valuesspec (MaybeFields a) (MaybeFields b)
- Opaleye.Internal.Constant: constant :: Default ToFields haskells fields => haskells -> fields
- Opaleye.Internal.Constant: type Constant = ToFields
- Opaleye.Internal.Join: data Nulled
- Opaleye.Internal.Order: distinctOnByCorrect :: Unpackspec b b -> (a -> b) -> Order a -> (a, PrimQuery, Tag) -> (a, PrimQuery, Tag)
- Opaleye.Internal.Order: distinctOnCorrect :: Unpackspec b b -> (a -> b) -> (a, PrimQuery, Tag) -> (a, PrimQuery, Tag)
- Opaleye.Internal.QueryArr: simpleQueryArr :: ((a, Tag) -> (b, PrimQuery, Tag)) -> QueryArr a b
- Opaleye.Internal.RunQuery: QueryRunner :: Unpackspec columns () -> (columns -> RowParser haskells) -> (columns -> Int) -> FromFields columns haskells
- Opaleye.Internal.RunQuery: QueryRunnerColumn :: Unpackspec (Column pgType) () -> FieldParser haskellType -> FromField pgType haskellType
- Opaleye.Internal.RunQuery: queryRunnerColumnDefault :: DefaultFromField sqlType haskellType => FromField sqlType haskellType
- Opaleye.Internal.RunQuery: type QueryRunner = FromFields
- Opaleye.Internal.RunQuery: type QueryRunnerColumn = FromField
- Opaleye.Internal.RunQuery: type QueryRunnerColumnDefault = DefaultFromField
- Opaleye.Internal.RunQueryExternal: queryRunnerColumn :: (Column a' -> Column a) -> (b -> b') -> FromField a b -> FromField a' b'
- Opaleye.Internal.RunQueryExternal: type QueryRunner = FromFields
- Opaleye.Internal.RunQueryExternal: type QueryRunnerColumn = FromField
- Opaleye.Internal.RunQueryExternal: type QueryRunnerColumnDefault = DefaultFromField
- Opaleye.Internal.Table: optional :: String -> TableFields (Maybe (Column a)) (Column a)
- Opaleye.Internal.Table: readOnly :: String -> TableFields () (Column a)
- Opaleye.Internal.Table: required :: String -> TableFields (Column a) (Column a)
- Opaleye.Internal.Table: tableColumn :: TableColumn writeType sqlType => String -> TableFields writeType (Column sqlType)
- Opaleye.Internal.Table: type TableColumns = TableFields
- Opaleye.Internal.Table: type TableProperties = TableFields
- Opaleye.Internal.TypeFamilies: type TableField f a b c d = TableRecordField f a b c d
- Opaleye.Internal.Unpackspec: unpackspecColumn :: Unpackspec (Column a) (Column a)
- Opaleye.Join: fullJoinInferrable :: (Default Unpackspec fieldsL fieldsL, Default Unpackspec fieldsR fieldsR, Default NullMaker fieldsL nullableFieldsL, Default NullMaker fieldsR nullableFieldsR, Map Nulled fieldsL ~ nullableFieldsL, Map Nulled fieldsR ~ nullableFieldsR) => Select fieldsL -> Select fieldsR -> ((fieldsL, fieldsR) -> Field SqlBool) -> Select (nullableFieldsL, nullableFieldsR)
- Opaleye.Join: leftJoinInferrable :: (Default Unpackspec fieldsL fieldsL, Default Unpackspec fieldsR fieldsR, Default NullMaker fieldsR nullableFieldsR, Map Nulled fieldsR ~ nullableFieldsR) => Select fieldsL -> Select fieldsR -> ((fieldsL, fieldsR) -> Field SqlBool) -> Select (fieldsL, nullableFieldsR)
- Opaleye.Join: rightJoinInferrable :: (Default Unpackspec fieldsL fieldsL, Default Unpackspec fieldsR fieldsR, Default NullMaker fieldsL nullableFieldsL, Map Nulled fieldsL ~ nullableFieldsL) => Select fieldsL -> Select fieldsR -> ((fieldsL, fieldsR) -> Field SqlBool) -> Select (nullableFieldsL, fieldsR)
- Opaleye.Manipulation: runInsertMany :: Connection -> Table columns columns' -> [columns] -> IO Int64
- Opaleye.Manipulation: runInsertManyOnConflictDoNothing :: Connection -> Table columns columns' -> [columns] -> IO Int64
- Opaleye.Manipulation: runInsertManyReturning :: Default FromFields columnsReturned haskells => Connection -> Table columnsW columnsR -> [columnsW] -> (columnsR -> columnsReturned) -> IO [haskells]
- Opaleye.Manipulation: runInsertManyReturningExplicit :: FromFields columnsReturned haskells -> Connection -> Table columnsW columnsR -> [columnsW] -> (columnsR -> columnsReturned) -> IO [haskells]
- Opaleye.Manipulation: runInsertManyReturningOnConflictDoNothing :: Default FromFields columnsReturned haskells => Connection -> Table columnsW columnsR -> [columnsW] -> (columnsR -> columnsReturned) -> IO [haskells]
- Opaleye.Manipulation: runInsertManyReturningOnConflictDoNothingExplicit :: FromFields columnsReturned haskells -> Connection -> Table columnsW columnsR -> [columnsW] -> (columnsR -> columnsReturned) -> IO [haskells]
- Opaleye.Manipulation: runInsertReturningExplicit :: FromFields columnsReturned haskells -> Connection -> Table columnsW columnsR -> columnsW -> (columnsR -> columnsReturned) -> IO [haskells]
- Opaleye.Manipulation: runUpdateEasy :: Default Updater columnsR columnsW => Connection -> Table columnsW columnsR -> (columnsR -> columnsR) -> (columnsR -> Column SqlBool) -> IO Int64
- Opaleye.Manipulation: runUpdateReturning :: Default FromFields columnsReturned haskells => Connection -> Table columnsW columnsR -> (columnsR -> columnsW) -> (columnsR -> Column SqlBool) -> (columnsR -> columnsReturned) -> IO [haskells]
- Opaleye.Manipulation: runUpdateReturningExplicit :: FromFields columnsReturned haskells -> Connection -> Table columnsW columnsR -> (columnsR -> columnsW) -> (columnsR -> Column SqlBool) -> (columnsR -> columnsReturned) -> IO [haskells]
- Opaleye.Operators: charLength :: PGString a => Column a -> Column Int
- Opaleye.Operators: exists :: QueryArr a b -> QueryArr a ()
- Opaleye.Operators: inQuery :: Default EqPP fields fields => fields -> Query fields -> Select (Field SqlBool)
- Opaleye.Operators: notExists :: QueryArr a b -> QueryArr a ()
- Opaleye.Operators: type PGIsJson = SqlIsJson
- Opaleye.Order: type PGOrd = SqlOrd
- Opaleye.QueryArr: type Query = SelectArr ()
- Opaleye.QueryArr: type QueryArr = SelectArr
- Opaleye.Sql: showSqlForPostgres :: forall columns. Default Unpackspec columns columns => Select columns -> Maybe String
- Opaleye.Sql: showSqlForPostgresExplicit :: Unpackspec columns b -> Select columns -> Maybe String
- Opaleye.Sql: showSqlForPostgresUnopt :: forall columns. Default Unpackspec columns columns => Select columns -> Maybe String
- Opaleye.Sql: showSqlForPostgresUnoptExplicit :: Unpackspec columns b -> Select columns -> Maybe String
- Opaleye.Table: Table :: String -> TableFields writeFields viewFields -> Table writeFields viewFields
- Opaleye.Table: TableWithSchema :: String -> String -> TableFields writeFields viewFields -> Table writeFields viewFields
- Opaleye.Table: data View columns
- Opaleye.Table: data Writer columns dummy
- Opaleye.Table: optional :: String -> TableFields (Maybe (Column a)) (Column a)
- Opaleye.Table: queryTable :: Default Unpackspec fields fields => Table a fields -> Select fields
- Opaleye.Table: queryTableExplicit :: Unpackspec tablefields fields -> Table a tablefields -> Select fields
- Opaleye.Table: readOnly :: String -> TableFields () (Column a)
- Opaleye.Table: required :: String -> TableFields (Column a) (Column a)
- Opaleye.Table: tableColumn :: TableColumn writeType sqlType => String -> TableFields writeType (Column sqlType)
- Opaleye.Table: type TableColumns = TableFields
- Opaleye.TypeFamilies: type TableField f a b c d = TableRecordField f a b c d
+ Opaleye.Distinct: distinctOn :: Default Unpackspec b b => (a -> b) -> Select a -> Select a
+ Opaleye.Distinct: distinctOnBy :: Default Unpackspec b b => (a -> b) -> Order a -> Select a -> Select a
+ Opaleye.Internal.RunQuery: FromField :: Unpackspec (Column pgType) () -> FieldParser haskellType -> FromField pgType haskellType
+ Opaleye.Internal.RunQuery: FromFields :: Unpackspec columns () -> (columns -> RowParser haskells) -> (columns -> Int) -> FromFields columns haskells
+ Opaleye.Internal.RunQuery: fromFieldNullable :: FromField a b -> FromField (Nullable a) (Maybe b)
+ Opaleye.Internal.RunQuery: fromFields :: FromField a b -> FromFields (Column a) b
+ Opaleye.Internal.RunQuery: withJsonByteStringParser :: (ByteString -> b) -> ByteString -> FieldParser b
+ Opaleye.Manipulation: data Returning fields haskells
+ Opaleye.Manipulation: doNothing :: OnConflict
+ Opaleye.Manipulation: runInsert :: Connection -> Insert haskells -> IO haskells
+ Opaleye.SqlTypes: showSqlType :: IsSqlType sqlType => proxy sqlType -> String
- Opaleye.Internal.Manipulation: data Returning a b
+ Opaleye.Internal.Manipulation: data Returning fields haskells
- Opaleye.Internal.Values: Nullspec :: Valuesspec fields fields' -> Nullspec fields fields'
+ Opaleye.Internal.Values: Nullspec :: Valuesspec Void fields' -> Nullspec fields fields'
- Opaleye.Manipulation: runDelete :: Connection -> Table a columnsR -> (columnsR -> Column SqlBool) -> IO Int64
+ Opaleye.Manipulation: runDelete :: Connection -> Delete haskells -> IO haskells
- Opaleye.Manipulation: runUpdate :: Connection -> Table columnsW columnsR -> (columnsR -> columnsW) -> (columnsR -> Column SqlBool) -> IO Int64
+ Opaleye.Manipulation: runUpdate :: Connection -> Update haskells -> IO haskells

Files

CHANGELOG.md view
@@ -1,3 +1,37 @@+## 0.8.0.0++* Removed the following deprecated functions, types and modules++  * `Opaleye.Query`, `Query`, `QueryArr`, `queryRunnerColumnDefault`+  * `Opaleye.RunQuery`, `runQuery`, `runQueryFold`,+    `queryRunnerColumn`+  * `Opaleye.Constant`, `constant`+  * The `Table` and `TableWithSchema` constructors+  * `View`, `Writer`, `required`, `optional`, `readOnly`,+    `tableColumn`, `queryTable`+  * `Nulled`, `leftJoinInferrable`, `rightJoinInferrable`, `fullJoinInferrable`+  * `unpackspecColumn`+  * `TableField`+  * `runInsertManyReturningOnConflictDoNothing`,+    `runInsertManyReturning`, `runUpdateEasy`, `runUpdateReturning`,+    `runDelete`+  * `charLength`, `exists`, `notExists`, `inQuery`+  * `PGIsJson`, `PGOrd`, `PG<typename>`+  * `showSqlForPostgres`, `showSqlForPostgresUnopt`++* Replaced the following old internal names++  * `QueryRunnerColumnDefault` -> `DefaultFromField`+  * `QueryRunnerColumn` -> `FromField` (type alias and constructor)+  * `QueryRunner` -> `FromFields` (type alias and constructor)++* `Opaleye.Join.optional` exported from top-level++* Bug fix: `distinctOn` and `distinctOnBy` now return a single row if+  zero columns are chosen to be distinct.++* Add `runInsert`/`Update`/`Delete` without underscore+ ## 0.7.6.2  Fix ISO 8601 date fomatting.  Thanks to Michal @kozak.
Test/Test.hs view
@@ -443,7 +443,7 @@      it "distinct on ()" $         let p = const ()-            q = O.distinctOnCorrect p table1Q+            q = O.distinctOn p table1Q         in distinctOn p q     it "distinct on (col1)" $         let p = fst@@ -461,7 +461,7 @@     it "distinct on () order by col1" $         let proj = const ()             ord  = f1-            q = O.distinctOnByCorrect proj (O.asc ord) $ O.values pgTriples+            q = O.distinctOnBy proj (O.asc ord) $ O.values pgTriples         in distinctOnBy proj ord q     it "distinct on (col1) order by col2" $         let proj = f1@@ -895,11 +895,11 @@   extras <- O.runInsert_ conn O.Insert { O.iTable = table10                                        , O.iRows = conflictsT                                        , O.iReturning = O.rReturning id-                                       , O.iOnConflict = Just O.DoNothing }+                                       , O.iOnConflict = Just O.doNothing }   moreExtras <- O.runInsert_ conn O.Insert { O.iTable = table10                                            , O.iRows = moreConflictsT                                            , O.iReturning = O.rCount-                                           , O.iOnConflict = Just O.DoNothing }+                                           , O.iOnConflict = Just O.doNothing }    returned `shouldBe` afterInsert   extras `shouldBe` afterConflicts
opaleye.cabal view
@@ -1,6 +1,6 @@ name:            opaleye copyright:       Copyright (c) 2014-2018 Purely Agile Limited; 2019-2021 Tom Ellis-version:         0.7.6.2+version:         0.8.0.0 synopsis:        An SQL-generating DSL targeting PostgreSQL description:     An SQL-generating DSL targeting PostgreSQL.  Allows                  Postgres queries to be written within Haskell in a@@ -50,7 +50,6 @@                    Opaleye.Aggregate,                    Opaleye.Binary,                    Opaleye.Column,-                   Opaleye.Constant,                    Opaleye.Distinct,                    Opaleye.Experimental.Enum,                    Opaleye.Exists,@@ -60,13 +59,9 @@                    Opaleye.Label,                    Opaleye.Lateral,                    Opaleye.Manipulation,-                   Opaleye.Map,                    Opaleye.MaybeFields,                    Opaleye.Operators,                    Opaleye.Order,-                   Opaleye.PGTypes,-                   Opaleye.QueryArr,-                   Opaleye.RunQuery,                    Opaleye.RunSelect,                    Opaleye.Select,                    Opaleye.Sql,
src/Opaleye.hs view
@@ -17,7 +17,6 @@                , module Opaleye.Aggregate                , module Opaleye.Binary                , module Opaleye.Column-               , module Opaleye.Internal.Constant                , module Opaleye.Distinct                , module Opaleye.Field                , module Opaleye.FunctionalJoin@@ -28,9 +27,6 @@                , module Opaleye.MaybeFields                , module Opaleye.Operators                , module Opaleye.Order-               , module Opaleye.Internal.PGTypesExternal-               , module Opaleye.QueryArr-               , module Opaleye.RunQuery                , module Opaleye.RunSelect                , module Opaleye.Sql                , module Opaleye.Select@@ -44,8 +40,6 @@ import Opaleye.Aggregate import Opaleye.Binary import Opaleye.Column-import Opaleye.Internal.Constant-  hiding (toFields) import Opaleye.Distinct import Opaleye.Field   hiding (null,@@ -56,22 +50,13 @@           maybeToNullable) import Opaleye.FunctionalJoin import Opaleye.Join-  hiding (optional) import Opaleye.Label import Opaleye.Lateral import Opaleye.Manipulation import Opaleye.MaybeFields-  hiding (optional) import Opaleye.Operators import Opaleye.Order-import Opaleye.Internal.PGTypesExternal-import Opaleye.QueryArr-import Opaleye.RunQuery import Opaleye.RunSelect-  hiding (foldForward,-          closeCursor,-          declareCursor,-          declareCursorExplicit) import Opaleye.Select import Opaleye.Sql import Opaleye.SqlTypes
src/Opaleye/Column.hs view
@@ -1,5 +1,5 @@ {-# OPTIONS_GHC -fno-warn-duplicate-exports #-}--- | Do not use.  Will be deprecated in version 0.8.  Use+-- | Do not use.  Will be deprecated in version 0.9.  Use -- "Opaleye.Field" instead. -- -- Functions for working directly with 'Column's.@@ -7,7 +7,7 @@ -- Please note that numeric 'Column' types are instances of 'Num', so -- you can use '*', '/', '+', '-' on them. ----- 'Column' will be renamed to 'Opaleye.Field.Field_' in version 0.8,+-- 'Column' will be renamed to 'Opaleye.Field.Field_' in version 0.9, -- so you might want to use the latter as much as you can.  module Opaleye.Column (-- * 'Column'
− src/Opaleye/Constant.hs
@@ -1,4 +0,0 @@-module Opaleye.Constant {-# DEPRECATED "Use \"Opaleye.ToFields\" instead.  Will be removed in version 0.8." #-}-  (module Opaleye.Internal.Constant) where--import Opaleye.Internal.Constant
src/Opaleye/Distinct.hs view
@@ -1,14 +1,17 @@ {-# LANGUAGE FlexibleContexts #-}  module Opaleye.Distinct (distinct,-                         distinctOnCorrect,-                         distinctOnByCorrect,-                         Distinctspec,+                         distinctOn,+                         distinctOnBy,                          -- * Explicit versions                          distinctExplicit,                          -- * Adaptors+                         Distinctspec,                          distinctspecField,                          distinctspecMaybeFields,+                         -- * Deprecated+                         distinctOnCorrect,+                         distinctOnByCorrect,                         )        where 
src/Opaleye/Experimental/Enum.hs view
@@ -13,11 +13,9 @@  import           Opaleye.Column (Column) import qualified Opaleye as O-import qualified Opaleye.Internal.Inferrable as I import qualified Opaleye.Internal.RunQuery as RQ  import           Data.ByteString.Char8 (unpack)-import qualified Data.Profunctor.Product.Default as D import Text.PrettyPrint.HughesPJ ((<>), doubleQuotes, render, text) import Prelude hiding ((<>)) @@ -142,7 +140,7 @@          Just r -> r          Nothing -> error ("Unexpected: " ++ unpack s) --- | Use 'enumMapper' instead.  Will be deprecated in 0.8.+{-# DEPRECATED fromFieldToFieldsEnum "Use 'enumMapper' instead.  Will be removed in 0.9." #-} fromFieldToFieldsEnum :: String                       -> (String -> Maybe haskellSum)                       -> (haskellSum -> String)
src/Opaleye/Field.hs view
@@ -10,7 +10,7 @@ -- SqlType@, and if you see @'C.Column' ('C.Nullable' SqlType)@ then -- you can understand it as @'FieldNullable' SqlType@. ----- 'C.Column' will be fully deprecated in version 0.8.+-- 'C.Column' will be fully deprecated in version 0.9.  {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE DataKinds #-}@@ -36,7 +36,7 @@ import qualified Opaleye.Column   as C import qualified Opaleye.Internal.PGTypesExternal  as T --- | The name @Column@ will be replaced by @Field@ in version 0.8.+-- | The name @Column@ will be replaced by @Field@ in version 0.9. -- The @Field_@, @Field@ and @FieldNullable@ types exist to help -- smooth the transition.  We recommend that you use @Field_@, @Field@ -- or @FieldNullable@ instead of @Column@ everywhere that it is
src/Opaleye/FunctionalJoin.hs view
@@ -30,8 +30,7 @@ import qualified Opaleye.SqlTypes                as T import qualified Opaleye.Operators               as O --- | Use 'Opaleye.Operators.where_' and @do@ notation instead.  Will--- be deprecated in 0.8.+{-# DEPRECATED joinF "Use 'Opaleye.Operators.where_' and @do@ notation instead.  Will be removed in 0.9." #-} joinF :: (fieldsL -> fieldsR -> fieldsResult)       -- ^ Calculate result fields from input fields       -> (fieldsL -> fieldsR -> F.Field T.SqlBool)@@ -44,7 +43,7 @@ joinF f cond l r =   fmap (uncurry f) (O.keepWhen (uncurry cond) <<< ((,) <$> l <*> r)) --- | Use 'Opaleye.Join.optional' instead.  Will be deprecated in 0.8.+{-# DEPRECATED leftJoinF "Use 'Opaleye.Join.optional' instead.  Will be removed in 0.9." #-} leftJoinF :: (D.Default IO.IfPP fieldsResult fieldsResult,               D.Default IU.Unpackspec fieldsL fieldsL,               D.Default IU.Unpackspec fieldsR fieldsR)@@ -76,7 +75,7 @@                                       (F.FieldNullable T.SqlBool)         nullmakerBool = D.def --- | Use 'Opaleye.Join.optional' instead.  Will be deprecated in 0.8.+{-# DEPRECATED rightJoinF "Use 'Opaleye.Join.optional' instead.  Will be removed in 0.9." #-} rightJoinF :: (D.Default IO.IfPP fieldsResult fieldsResult,                D.Default IU.Unpackspec fieldsL fieldsL,                D.Default IU.Unpackspec fieldsR fieldsR)
src/Opaleye/Internal/Column.hs view
@@ -10,7 +10,7 @@ -- @SqlInt4@ is an @int4@ column and a 'Column' @SqlText@ is a @text@ -- column. ----- The name @Column@ will be replaced by @Field@ in version 0.8.+-- The name @Column@ will be replaced by @Field@ in version 0.9. -- There already exists a @Field@ type family to help smooth the -- transition.  We recommend that you use @Field_@, @Field@ or -- @FieldNullable@ instead of @Column@ everywhere that it is
src/Opaleye/Internal/Constant.hs view
@@ -31,16 +31,10 @@          => haskells -> fields toFields = constantExplicit D.def -{-# DEPRECATED constant "Use 'toFields' instead.  Will be removed in version 0.8." #-}-constant :: D.Default ToFields haskells fields-         => haskells -> fields-constant = constantExplicit D.def-+-- | A way of turning Haskell values of type @haskells@ into SQL+-- fields.  Use it with 'Opaleye.ToFields.toFields'. newtype ToFields haskells fields =   ToFields { constantExplicit :: haskells -> fields }--{-# DEPRECATED Constant "Use 'ToFields' instead.  Will be removed in version 0.8." #-}-type Constant = ToFields  instance D.Default ToFields haskell (Column sql)          => D.Default ToFields (Maybe haskell) (Column (C.Nullable sql)) where
src/Opaleye/Internal/Inferrable.hs view
@@ -38,12 +38,12 @@ instance {-# OVERLAPPABLE #-}   D.Default (Inferrable FromField) a b   => D.Default (Inferrable FromFields) (C.Column a) b where-  def = Inferrable (RQ.queryRunner (runInferrable D.def))+  def = Inferrable (RQ.fromFields (runInferrable D.def))  instance      (D.Default (Inferrable FromField) a b, Maybe b ~ maybe_b)   => D.Default (Inferrable FromFields) (C.Column (C.Nullable a)) maybe_b where-  def = Inferrable (RQ.queryRunner (RQ.queryRunnerColumnNullable (runInferrable D.def)))+  def = Inferrable (RQ.fromFields (RQ.fromFieldNullable (runInferrable D.def)))  -- FromField @@ -112,29 +112,29 @@ -- It's not clear what to map JSON types to  {--instance QueryRunnerColumnDefault T.PGJson String where-  defaultFromField = fieldParserQueryRunnerColumn jsonFieldParser+instance DefaultFromField T.PGJson String where+  defaultFromField = fromPGSFieldParser jsonFieldParser -instance QueryRunnerColumnDefault T.PGJson Ae.Value where+instance DefaultFromField T.PGJson Ae.Value where   defaultFromField = fromPGSFromField -instance QueryRunnerColumnDefault T.PGJsonb String where-  defaultFromField = fieldParserQueryRunnerColumn jsonbFieldParser+instance DefaultFromField T.PGJsonb String where+  defaultFromField = fromPGSFieldParser jsonbFieldParser -instance QueryRunnerColumnDefault T.PGJsonb Ae.Value where+instance DefaultFromField T.PGJsonb Ae.Value where   defaultFromField = fromPGSFromField -instance QueryRunnerColumnDefault T.PGTimestamptz Time.UTCTime where+instance DefaultFromField T.PGTimestamptz Time.UTCTime where   defaultFromField = fromPGSFromField -instance QueryRunnerColumnDefault T.PGTimestamptz Time.ZonedTime where+instance DefaultFromField T.PGTimestamptz Time.ZonedTime where   defaultFromField = fromPGSFromField -}  -- ToFields  {- The instance for arrays would clash with String.  String is going to-   be use far more, so to get arrays you'll have to explicitly use+   be used far more, so to get arrays you'll have to explicitly use    `sqlArray`.  instance (D.Default (Inferrable ToFields) a (C.Column b),
src/Opaleye/Internal/Join.hs view
@@ -135,35 +135,3 @@ instance PP.ProductProfunctor NullMaker where   purePP = pure   (****) = (<*>)------{-# DEPRECATED Nulled "Will be removed in version 0.8" #-}-data Nulled--type instance TF.IMap Nulled TF.OT     = TF.NullsT-type instance TF.IMap Nulled TF.NullsT = TF.NullsT---- It's quite unfortunate that we have to write these out by hand--- until we probably do nullability as a distinction between------ Column (Nullable a)--- Column (NonNullable a)--type instance Map.Map Nulled (Column (Nullable a)) = Column (Nullable a)--type instance Map.Map Nulled (Column T.PGInt4) = Column (Nullable T.PGInt4)-type instance Map.Map Nulled (Column T.PGInt8) = Column (Nullable T.PGInt8)-type instance Map.Map Nulled (Column T.PGText) = Column (Nullable T.PGText)-type instance Map.Map Nulled (Column T.PGFloat8) = Column (Nullable T.PGFloat8)-type instance Map.Map Nulled (Column T.PGBool) = Column (Nullable T.PGBool)-type instance Map.Map Nulled (Column T.PGUuid) = Column (Nullable T.PGUuid)-type instance Map.Map Nulled (Column T.PGBytea) = Column (Nullable T.PGBytea)-type instance Map.Map Nulled (Column T.PGText) = Column (Nullable T.PGText)-type instance Map.Map Nulled (Column T.PGDate) = Column (Nullable T.PGDate)-type instance Map.Map Nulled (Column T.PGTimestamp) = Column (Nullable T.PGTimestamp)-type instance Map.Map Nulled (Column T.PGTimestamptz) = Column (Nullable T.PGTimestamptz)-type instance Map.Map Nulled (Column T.PGTime) = Column (Nullable T.PGTime)-type instance Map.Map Nulled (Column T.PGCitext) = Column (Nullable T.PGCitext)-type instance Map.Map Nulled (Column T.PGJson) = Column (Nullable T.PGJson)-type instance Map.Map Nulled (Column T.PGJsonb) = Column (Nullable T.PGJsonb)
src/Opaleye/Internal/Manipulation.hs view
@@ -32,9 +32,8 @@  import qualified Database.PostgreSQL.Simple as PGS --- | Don't use this internal datatype.  Instead you probably want--- 'Opaleye.Manipulation.rCount' or 'Opaleye.Manipulation.rReturning'.-data Returning a b where+-- | Represents a @RETURNING@ statement for a manipulation query.+data Returning fields haskells where   Count     :: Returning a Int64   ReturningExplicit@@ -97,7 +96,7 @@                        (fromString                         (arrangeInsertManyReturningSql u t columns' r                                                        onConflict))-  where IRQ.QueryRunner u _ _ = qr+  where IRQ.FromFields u _ _ = qr         parser = IRQ.prepareRowParser qr (r v)         TI.View v = TI.tableColumnsView (TI.tableColumns t)         -- This method of getting hold of the return type feels a bit@@ -175,7 +174,7 @@ runDeleteReturningExplicit qr conn t cond r =   PGS.queryWith_ parser conn                  (fromString (arrangeDeleteReturningSql u t cond r))-  where IRQ.QueryRunner u _ _ = qr+  where IRQ.FromFields u _ _ = qr         parser = IRQ.prepareRowParser qr (r v)         TI.View v = TI.tableColumnsView (TI.tableColumns t) 
src/Opaleye/Internal/MaybeFields.hs view
@@ -175,7 +175,7 @@  fromFieldsMaybeFields :: RQ.FromFields fields haskells                       -> RQ.FromFields (MaybeFields fields) (Maybe haskells)-fromFieldsMaybeFields (RQ.QueryRunner u p c) = RQ.QueryRunner u' p' c'+fromFieldsMaybeFields (RQ.FromFields u p c) = RQ.FromFields u' p' c'   where u' = () <$ productProfunctorMaybeFields U.unpackspecField u          p' = \mf -> do
src/Opaleye/Internal/Order.hs view
@@ -23,9 +23,9 @@ used, and so on. -} --- Like the (columns -> RowParser haskells) field of QueryRunner this+-- Like the (columns -> RowParser haskells) field of FromFields this -- type is "too big".  We never actually look at the 'a' (in the--- QueryRunner case the 'colums') except to check the "structure".+-- FromFields case the 'columns') except to check the "structure". -- This is so we can support a SumProfunctor instance. newtype Order a = Order (a -> [(HPQ.OrderOp, HPQ.PrimExpr)]) @@ -69,23 +69,12 @@            -> (a, PQ.PrimQuery, T.Tag) -> (a, PQ.PrimQuery, T.Tag) distinctOn ups proj = distinctOnBy ups proj M.mempty -distinctOnCorrect :: U.Unpackspec b b -> (a -> b)-                  -> (a, PQ.PrimQuery, T.Tag) -> (a, PQ.PrimQuery, T.Tag)-distinctOnCorrect ups proj = distinctOnByCorrect ups proj M.mempty- distinctOnBy :: U.Unpackspec b b -> (a -> b) -> Order a              -> (a, PQ.PrimQuery, T.Tag) -> (a, PQ.PrimQuery, T.Tag) distinctOnBy ups proj ord (cols, pq, t) = (cols, pqOut, t)-    where pqOut = case U.collectPEs ups (proj cols) of-            x:xs -> PQ.DistinctOnOrderBy (Just $ x NL.:| xs) (orderExprs cols ord) pq-            []   -> pq--distinctOnByCorrect :: U.Unpackspec b b -> (a -> b) -> Order a-             -> (a, PQ.PrimQuery, T.Tag) -> (a, PQ.PrimQuery, T.Tag)-distinctOnByCorrect ups proj ord (cols, pq, t) = (cols, pqOut, t)-    where pqOut = case U.collectPEs ups (proj cols) of-            x:xs -> PQ.DistinctOnOrderBy (Just $ x NL.:| xs) oexprs pq-            []   -> PQ.Limit (PQ.LimitOp 1) (PQ.DistinctOnOrderBy Nothing oexprs pq)+    where pqOut = case NL.nonEmpty (U.collectPEs ups (proj cols)) of+            Just xs -> PQ.DistinctOnOrderBy (Just xs) oexprs pq+            Nothing -> PQ.Limit (PQ.LimitOp 1) (PQ.DistinctOnOrderBy Nothing oexprs pq)           oexprs = orderExprs cols ord  -- | Order the results of a given query exactly, as determined by the given list
src/Opaleye/Internal/PrimQuery.hs view
@@ -54,6 +54,7 @@ -- convenient to allow 'Empty', but it is hard to represent 'Empty' in -- SQL so we remove it in 'Optimize' and set 'a = Void'. data PrimQuery' a = Unit+                  -- Remove the Empty constructor in 0.9                   | Empty     a                   | BaseTable TableIdentifier (Bindings HPQ.PrimExpr)                   | Product   (NEL.NonEmpty (Lateral, PrimQuery' a)) [HPQ.PrimExpr]
src/Opaleye/Internal/QueryArr.hs view
@@ -63,11 +63,6 @@   where g (a0, t0) = (a1, \lat primQueryL ->                             PQ.Join PQ.LeftJoin cond (PQ.NonLateral, primQueryL) (lat, primQuery'), t1)           where (a1, cond, primQuery', t1) = f (a0, t0)--{-# DEPRECATED simpleQueryArr "Use 'productQueryArr' instead. Its name indicates better what it actually does" #-}-simpleQueryArr :: ((a, Tag) -> (b, PQ.PrimQuery, Tag)) -> QueryArr a b-simpleQueryArr = productQueryArr- mapPrimQuery :: (PQ.PrimQuery -> PQ.PrimQuery) -> SelectArr a b -> SelectArr a b mapPrimQuery f sa =   QueryArr ((\(b, pqf, t) -> (b, \lat -> f . pqf lat, t)) . runQueryArr sa)
src/Opaleye/Internal/RunQuery.hs view
@@ -73,13 +73,13 @@ -- be that we can't add nullability to a RowParser, only to a -- FieldParser, so we have to have some type that we know contains -- just a FieldParser.++-- Why isn't this a newtype? data FromField pgType haskellType =-  QueryRunnerColumn (U.Unpackspec (Column pgType) ()) (FieldParser haskellType)+  FromField (U.Unpackspec (Column pgType) ()) (FieldParser haskellType)  instance Functor (FromField u) where-  fmap f ~(QueryRunnerColumn u fp) = QueryRunnerColumn u ((fmap . fmap . fmap) f fp)--type QueryRunnerColumn = FromField+  fmap f ~(FromField u fp) = FromField u ((fmap . fmap . fmap) f fp)  -- | A 'FromFields' --   specifies how to convert Postgres values (@fields@)@@ -92,7 +92,7 @@ -- 'FromFields' @columns@ @haskells@\" corresponds to -- postgresql-simple's \"@FromRow@ @haskells@\". data FromFields columns haskells =-  QueryRunner (U.Unpackspec columns ())+   FromFields (U.Unpackspec columns ())               (columns -> RowParser haskells)               -- We never actually look at the columns except to see               -- its "type" in the case of a sum profunctor@@ -110,45 +110,54 @@               -- SqlInt4)' has no columns when it is Nothing and one               -- column when it is Just. -type QueryRunner = FromFields-+{-# DEPRECATED fieldQueryRunnerColumn "Will be removed in version 0.9.  Use fromPGSFromField instead." #-} fieldQueryRunnerColumn :: PGS.FromField haskell => FromField pgType haskell fieldQueryRunnerColumn = fromPGSFromField  fromPGSFromField :: PGS.FromField haskell => FromField pgType haskell-fromPGSFromField = fieldParserQueryRunnerColumn fromField+fromPGSFromField = fromPGSFieldParser fromField +{-# DEPRECATED fieldParserQueryRunnerColumn " Will be removed in version 0.9.  Use fromPGSFieldParser instead." #-} fieldParserQueryRunnerColumn :: FieldParser haskell -> FromField pgType haskell fieldParserQueryRunnerColumn = fromPGSFieldParser  fromPGSFieldParser :: FieldParser haskell -> FromField pgType haskell-fromPGSFieldParser = QueryRunnerColumn (P.rmap (const ()) U.unpackspecField)+fromPGSFieldParser = FromField (P.rmap (const ()) U.unpackspecField) +fromFields :: FromField a b -> FromFields (Column a) b+fromFields qrc = FromFields u (const (fieldWith fp)) (const 1)+    where FromField u fp = qrc++{-# DEPRECATED queryRunner "Use fromFields instead.  Will be removed in version 0.9." #-} queryRunner :: FromField a b -> FromFields (Column a) b-queryRunner qrc = QueryRunner u (const (fieldWith fp)) (const 1)-    where QueryRunnerColumn u fp = qrc+queryRunner = fromFields -queryRunnerColumnNullable :: FromField a b-                          -> FromField (Nullable a) (Maybe b)-queryRunnerColumnNullable qr =-  QueryRunnerColumn (P.lmap C.unsafeCoerceColumn u) (fromField' fp)-  where QueryRunnerColumn u fp = qr+fromFieldNullable :: FromField a b+                  -> FromField (Nullable a) (Maybe b)+fromFieldNullable qr =+  FromField (P.lmap C.unsafeCoerceColumn u) (fromField' fp)+  where FromField u fp = qr         fromField' :: FieldParser a -> FieldParser (Maybe a)         fromField' _ _ Nothing = pure Nothing         fromField' fp' f bs = fmap Just (fp' f bs) +{-# DEPRECATED queryRunnerColumnNullable "Use fromFieldNullable instead.  Will be deprecated in 0.9." #-}+queryRunnerColumnNullable :: FromField a b+                          -> FromField (Nullable a) (Maybe b)+queryRunnerColumnNullable = fromFieldNullable+ unsafeFromFieldRaw :: FromField a (PGS.Field, Maybe SBS.ByteString)-unsafeFromFieldRaw = fieldParserQueryRunnerColumn (\f mdata -> pure (f, mdata))+unsafeFromFieldRaw = fromPGSFieldParser (\f mdata -> pure (f, mdata))  -- { Instances for automatic derivation  instance DefaultFromField a b =>          DefaultFromField (Nullable a) (Maybe b) where-  defaultFromField = queryRunnerColumnNullable defaultFromField+  defaultFromField = fromFieldNullable defaultFromField  instance DefaultFromField a b =>          D.Default FromFields (Column a) b where-  def = queryRunner defaultFromField+  def = fromFields defaultFromField  -- } @@ -181,17 +190,9 @@ -- 3. If you have a more complicated case, but not a 'PGS.FromField' instance, -- write a 'FieldParser' for your type and use 'fromPGSFieldParser'. -- You can also add a 'FromField' instance using this.-{-# DEPRECATED queryRunnerColumnDefault "Use defaultFromField instead.  It will be removed in 0.8" #-} class DefaultFromField sqlType haskellType where-  queryRunnerColumnDefault :: FromField sqlType haskellType-  queryRunnerColumnDefault = defaultFromField   defaultFromField         :: FromField sqlType haskellType-  defaultFromField = queryRunnerColumnDefault -  {-# MINIMAL queryRunnerColumnDefault | defaultFromField #-}--type QueryRunnerColumnDefault = DefaultFromField- instance DefaultFromField sqlType haskellType     => D.Default FromField sqlType haskellType where   def = defaultFromField@@ -266,37 +267,37 @@   defaultFromField = fromPGSFromField  instance DefaultFromField T.SqlJson String where-  defaultFromField = fieldParserQueryRunnerColumn jsonFieldParser+  defaultFromField = fromPGSFieldParser jsonFieldParser  instance DefaultFromField T.SqlJson ST.Text where-  defaultFromField = fieldParserQueryRunnerColumn jsonFieldTextParser+  defaultFromField = fromPGSFieldParser jsonFieldTextParser  instance DefaultFromField T.SqlJson LT.Text where-  defaultFromField = fieldParserQueryRunnerColumn jsonFieldLazyTextParser+  defaultFromField = fromPGSFieldParser jsonFieldLazyTextParser  instance DefaultFromField T.SqlJson SBS.ByteString where-  defaultFromField = fieldParserQueryRunnerColumn jsonFieldByteParser+  defaultFromField = fromPGSFieldParser jsonFieldByteParser  instance DefaultFromField T.SqlJson LBS.ByteString where-  defaultFromField = fieldParserQueryRunnerColumn jsonFieldLazyByteParser+  defaultFromField = fromPGSFieldParser jsonFieldLazyByteParser  instance DefaultFromField T.SqlJson Ae.Value where   defaultFromField = fromPGSFromField  instance DefaultFromField T.SqlJsonb String where-  defaultFromField = fieldParserQueryRunnerColumn jsonbFieldParser+  defaultFromField = fromPGSFieldParser jsonbFieldParser  instance DefaultFromField T.SqlJsonb ST.Text where-  defaultFromField = fieldParserQueryRunnerColumn jsonbFieldTextParser+  defaultFromField = fromPGSFieldParser jsonbFieldTextParser  instance DefaultFromField T.SqlJsonb LT.Text where-  defaultFromField = fieldParserQueryRunnerColumn jsonbFieldLazyTextParser+  defaultFromField = fromPGSFieldParser jsonbFieldLazyTextParser  instance DefaultFromField T.SqlJsonb SBS.ByteString where-  defaultFromField = fieldParserQueryRunnerColumn jsonbFieldByteParser+  defaultFromField = fromPGSFieldParser jsonbFieldByteParser  instance DefaultFromField T.SqlJsonb LBS.ByteString where-  defaultFromField = fieldParserQueryRunnerColumn jsonbFieldLazyByteParser+  defaultFromField = fromPGSFieldParser jsonbFieldLazyByteParser  instance DefaultFromField T.SqlJsonb Ae.Value where   defaultFromField = fromPGSFromField@@ -312,9 +313,9 @@  fromFieldArray :: Typeable h => FromField f h -> FromField (T.SqlArray f) [h] fromFieldArray q =-  QueryRunnerColumn (P.lmap arrayColumn c)-                    ((fmap . fmap . fmap) fromPGArray (pgArrayFieldParser f))-  where QueryRunnerColumn c f = q+  FromField (P.lmap arrayColumn c)+            ((fmap . fmap . fmap) fromPGArray (pgArrayFieldParser f))+  where FromField c f = q  -- } @@ -326,36 +327,36 @@                => FromField a b                -> FromField (T.PGRange a) (PGSR.PGRange b) fromFieldRange off =-  QueryRunnerColumn (P.lmap C.unsafeCoerceColumn c) (PGSR.fromFieldRange pff)-  where QueryRunnerColumn c pff = off+  FromField (P.lmap C.unsafeCoerceColumn c) (PGSR.fromFieldRange pff)+  where FromField c pff = off  -- Boilerplate instances  instance Functor (FromFields c) where-  fmap f (QueryRunner u r b) = QueryRunner u ((fmap . fmap) f r) b+  fmap f (FromFields u r b) = FromFields u ((fmap . fmap) f r) b  -- TODO: Seems like this one should be simpler! instance Applicative (FromFields c) where-  pure = flip (QueryRunner (P.lmap (const ()) PP.empty)) (const 0)+  pure = flip (FromFields (P.lmap (const ()) PP.empty)) (const 0)          . pure          . pure-  QueryRunner uf rf bf <*> QueryRunner ux rx bx =-    QueryRunner (P.dimap (\x -> (x,x)) (const ()) (uf PP.***! ux)) ((<*>) <$> rf <*> rx) (liftA2 (+) bf bx)+  FromFields uf rf bf <*> FromFields ux rx bx =+    FromFields (P.dimap (\x -> (x,x)) (const ()) (uf PP.***! ux)) ((<*>) <$> rf <*> rx) (liftA2 (+) bf bx)  instance P.Profunctor FromFields where-  dimap f g (QueryRunner u r b) =-    QueryRunner (P.lmap f u) (P.dimap f (fmap g) r) (P.lmap f b)+  dimap f g (FromFields u r b) =+    FromFields (P.lmap f u) (P.dimap f (fmap g) r) (P.lmap f b)  instance PP.ProductProfunctor FromFields where   purePP = pure   (****) = (<*>)  instance PP.SumProfunctor FromFields where-  f +++! g = QueryRunner (P.rmap (const ()) (fu PP.+++! gu))+  f +++! g = FromFields (P.rmap (const ()) (fu PP.+++! gu))                          (PackMap.eitherFunction fr gr)                          (either fb gb)-    where QueryRunner fu fr fb = f-          QueryRunner gu gr gb = g+    where FromFields fu fr fb = f+          FromFields gu gr gb = g  -- } @@ -387,15 +388,6 @@ -- Eventually we want to move this to postgresql-simple -- --     https://github.com/tomjaguarpaw/haskell-opaleye/issues/329-jsonFieldTypeParser :: SBS.ByteString -> FieldParser String-jsonFieldTypeParser = (fmap . fmap . fmap . fmap) IPT.strictDecodeUtf8 jsonFieldTypeByteParser--jsonFieldTypeTextParser :: SBS.ByteString -> FieldParser ST.Text-jsonFieldTypeTextParser = (fmap . fmap . fmap . fmap) STE.decodeUtf8 jsonFieldTypeByteParser--jsonFieldTypeLazyTextParser :: SBS.ByteString -> FieldParser LT.Text-jsonFieldTypeLazyTextParser = (fmap . fmap . fmap . fmap) (LTE.decodeUtf8 . LBS.fromStrict) jsonFieldTypeByteParser- jsonFieldTypeByteParser :: SBS.ByteString -> FieldParser SBS.ByteString jsonFieldTypeByteParser jsonTypeName field mData = do     ti <- typeInfo field@@ -407,13 +399,26 @@         Just bs -> pure bs         _       -> returnError UnexpectedNull field "" +withJsonByteStringParser :: (SBS.ByteString -> b)+                         -> SBS.ByteString -> FieldParser b+withJsonByteStringParser f = (fmap . fmap . fmap . fmap) f jsonFieldTypeByteParser++jsonFieldTypeParser :: SBS.ByteString -> FieldParser String+jsonFieldTypeParser = withJsonByteStringParser IPT.strictDecodeUtf8++jsonFieldTypeTextParser :: SBS.ByteString -> FieldParser ST.Text+jsonFieldTypeTextParser = withJsonByteStringParser STE.decodeUtf8++jsonFieldTypeLazyTextParser :: SBS.ByteString -> FieldParser LT.Text+jsonFieldTypeLazyTextParser = withJsonByteStringParser (LTE.decodeUtf8 . LBS.fromStrict)+ jsonFieldTypeLazyByteParser :: SBS.ByteString -> FieldParser LBS.ByteString-jsonFieldTypeLazyByteParser = (fmap . fmap . fmap . fmap) LBS.fromStrict jsonFieldTypeByteParser+jsonFieldTypeLazyByteParser = withJsonByteStringParser LBS.fromStrict  -- }  prepareRowParser :: FromFields columns haskells -> columns -> RowParser haskells-prepareRowParser (QueryRunner _ rowParser numColumns) cols =+prepareRowParser (FromFields _ rowParser numColumns) cols =   if numColumns cols > 0   then rowParser cols   else (fromRow :: RowParser (Only Int)) *> rowParser cols@@ -427,7 +432,7 @@ data Cursor haskells = EmptyCursor | Cursor (RowParser haskells) PGSC.Cursor  prepareQuery :: FromFields fields haskells -> S.Select fields -> (Maybe PGS.Query, RowParser haskells)-prepareQuery qr@(QueryRunner u _ _) q = (sql, parser)+prepareQuery qr@(FromFields u _ _) q = (sql, parser)   where sql :: Maybe PGS.Query         sql = fmap String.fromString (S.showSqlExplicit u q)         -- FIXME: We're doing work twice here
src/Opaleye/Internal/RunQueryExternal.hs view
@@ -6,10 +6,7 @@                          IRQ.Cursor,                          IRQ.FromFields,                          IRQ.FromField,-                         QueryRunner,-                         IRQ.QueryRunnerColumn,-                         IRQ.QueryRunnerColumnDefault,-                         -- * Creating new 'QueryRunnerColumn's+                         -- * Creating new 'FromField's                          IRQ.fieldQueryRunnerColumn,                          IRQ.fieldParserQueryRunnerColumn) where @@ -19,7 +16,7 @@  import           Opaleye.Column (Column) import qualified Opaleye.Select as S-import           Opaleye.Internal.RunQuery (QueryRunner, prepareQuery)+import           Opaleye.Internal.RunQuery (prepareQuery) import qualified Opaleye.Internal.RunQuery as IRQ  import qualified Data.Profunctor as P@@ -27,14 +24,12 @@  -- * Running 'S.Select's -{-# DEPRECATED runQuery "Use 'Opaleye.RunSelect.runSelect' instead.  @runQuery@ will be removed in 0.8." #-} runQuery :: D.Default IRQ.FromFields fields haskells          => PGS.Connection          -> S.Select fields          -> IO [haskells] runQuery = runQueryExplicit D.def -{-# DEPRECATED runQueryFold "Use 'Opaleye.RunSelect.runSelectFold' instead.  @runQueryFold@ will be removed in 0.8." #-} runQueryFold   :: D.Default IRQ.FromFields fields haskells   => PGS.Connection@@ -44,19 +39,8 @@   -> IO b runQueryFold = runQueryFoldExplicit D.def --- * Creating new 'QueryRunnerColumn's--{-# DEPRECATED queryRunnerColumn "Use 'Opaleye.RunSelect.unsafeFromField' instead. @queryRunnerColumn@ will be removed in 0.8." #-}-queryRunnerColumn :: (Column a' -> Column a) -> (b -> b')-                  -> IRQ.FromField a b -> IRQ.FromField a' b'-queryRunnerColumn colF haskellF qrc = IRQ.QueryRunnerColumn (P.lmap colF u)-                                                            (fmapFP haskellF fp)-  where IRQ.QueryRunnerColumn u fp = qrc-        fmapFP = fmap . fmap . fmap- -- * Explicit versions -{-# DEPRECATED runQueryExplicit "Use 'Opaleye.RunSelect.runSelectExplict' instead.  Will be removed in 0.8." #-} runQueryExplicit :: IRQ.FromFields fields haskells                  -> PGS.Connection                  -> S.Select fields@@ -64,7 +48,6 @@ runQueryExplicit qr conn q = maybe (return []) (PGS.queryWith_ parser conn) sql   where (sql, parser) = IRQ.prepareQuery qr q -{-# DEPRECATED runQueryFoldExplicit "Use 'Opaleye.RunSelect.runSelectFoldExplict' instead.  Will be deprecated in 0.8." #-} runQueryFoldExplicit   :: IRQ.FromFields fields haskells   -> PGS.Connection@@ -79,7 +62,6 @@  -- * Cursor interface -{-# DEPRECATED declareCursor "Use 'Opaleye.RunSelect.declareCursor' instead.  Will be removed in 0.8." #-} declareCursor     :: D.Default IRQ.FromFields fields haskells     => PGS.Connection@@ -87,7 +69,6 @@     -> IO (IRQ.Cursor haskells) declareCursor = declareCursorExplicit D.def -{-# DEPRECATED declareCursorExplicit "Use 'Opaleye.RunSelect.declareCursorExplicit' instead.  Will be removed in 0.8." #-} declareCursorExplicit     :: IRQ.FromFields fields haskells     -> PGS.Connection@@ -100,12 +81,10 @@   where     (mbQuery, rowParser) = prepareQuery qr q -{-# DEPRECATED closeCursor "Use 'Opaleye.RunSelect.closeCursor' instead.  Will be removed in 0.8." #-} closeCursor :: IRQ.Cursor fields -> IO () closeCursor IRQ.EmptyCursor       = pure () closeCursor (IRQ.Cursor _ cursor) = PGSC.closeCursor cursor -{-# DEPRECATED foldForward "Use 'Opaleye.RunSelect.foldForward' instead.  Will be removed in 0.8." #-} foldForward     :: IRQ.Cursor haskells     -> Int
src/Opaleye/Internal/Table.hs view
@@ -48,17 +48,9 @@ --                                      , quantity = tableField \"quantity\" --                                      , radius   = tableField \"radius\" }) -- @------ The constructors of Table are internal only and will be--- removed in version 0.8. data Table writeFields viewFields   = Table String (TableFields writeFields viewFields)-    -- ^ For unqualified table names. Do not use the constructor.  It-    -- is considered deprecated and will be removed in version 0.8.   | TableWithSchema String String (TableFields writeFields viewFields)-    -- ^ Schema name, table name, table properties.  Do not use the-    -- constructor.  It is considered deprecated and will be removed-    -- in version 0.8.  tableIdentifier :: Table writeColumns viewColumns -> PQ.TableIdentifier tableIdentifier (Table t _) = PQ.TableIdentifier Nothing t@@ -76,12 +68,6 @@    { tablePropertiesWriter :: Writer writeColumns viewColumns    , tablePropertiesView   :: View viewColumns } -{-# DEPRECATED TableColumns "Use 'TableFields' instead. 'TableColumns' will be removed in  version 0.8." #-}-type TableColumns = TableFields--{-# DEPRECATED TableProperties "Use 'TableFields' instead. 'TableProperties' will be removed in  version 0.8." #-}-type TableProperties = TableFields- tableColumnsWriter :: TableFields writeColumns viewColumns                    -> Writer writeColumns viewColumns tableColumnsWriter = tablePropertiesWriter@@ -90,11 +76,8 @@                  -> View viewColumns tableColumnsView = tablePropertiesView -{-# DEPRECATED View "Internal only.  Do not use.  'View' will be removed in version 0.8." #-} newtype View columns = View columns -{-# DEPRECATED Writer "Internal only.  Do not use.  'Writer' will be removed in 0.8." #-}- -- There's no reason the second parameter should exist except that we -- use ProductProfunctors more than ProductContravariants so it makes -- things easier if we make it one of the former.@@ -128,23 +111,7 @@ readOnlyTableField :: String -> TableFields () (Column a) readOnlyTableField = lmap (const Nothing) . optionalTableField -{-# DEPRECATED required  "Use 'requiredTableField' instead.  Will be removed in version 0.8." #-}-required :: String -> TableFields (Column a) (Column a)-required = requiredTableField--{-# DEPRECATED optional "Use 'optionalTableField' instead.  Will be removed in version 0.8." #-}-optional :: String -> TableFields (Maybe (Column a)) (Column a)-optional = optionalTableField--{-# DEPRECATED readOnly "Use 'readOnlyTableField' instead.  Will be removed in version 0.8." #-}-readOnly :: String -> TableFields () (Column a)-readOnly = readOnlyTableField--{-# DEPRECATED tableColumn "Use 'tableField' instead.  Will be removed in 0.8." #-}- class TableColumn writeType sqlType | writeType -> sqlType where-    tableColumn :: String -> TableFields writeType (Column sqlType)-    tableColumn = tableField     -- | Infer either a required ('requiredTableField') or optional     -- ('optionalTableField') field depending on     -- the write type.  It's generally more convenient to use this
src/Opaleye/Internal/TypeFamilies.hs view
@@ -75,9 +75,6 @@ type RecordField f a b c = A f ('C '(a, b, c)) type TableRecordField f a b c d = A f ('TC '( '(a, b, c), d)) -{-# DEPRECATED TableField "Use 'TableRecordField' instead.  Will be remoed in version 0.8." #-}-type TableField f a b c d = TableRecordField f a b c d- -- | Type families parameter for Haskell types ('String', 'Int', etc.) type H = 'H HT -- | Type families parameter for Opaleye types ('Opaleye.Field.Field'
src/Opaleye/Internal/Unpackspec.hs view
@@ -35,10 +35,6 @@   -- 'Profunctor', 'ProductProfunctor' and 'SumProfunctor' operations.   Unpackspec (PM.PackMap HPQ.PrimExpr HPQ.PrimExpr columns columns') -{-# DEPRECATED unpackspecColumn "Use 'unpackspecField' instead.  Will be removed in version 0.8." #-}-unpackspecColumn :: Unpackspec (C.Column a) (C.Column a)-unpackspecColumn = Unpackspec (PM.iso IC.unColumn IC.Column)- -- | Target the single 'HPQ.PrimExpr' inside a 'C.Column' unpackspecField :: Unpackspec (C.Column a) (C.Column a) unpackspecField = Unpackspec (PM.iso IC.unColumn IC.Column)
src/Opaleye/Internal/Values.hs view
@@ -17,6 +17,7 @@ import           Data.Profunctor.Product (ProductProfunctor) import qualified Data.Profunctor.Product as PP import           Data.Profunctor.Product.Default (Default, def)+import           Data.Void (Void, absurd)  import           Control.Applicative (Applicative, pure, (<*>)) @@ -101,6 +102,7 @@   ValuesspecSafe (PM.PackMap HPQ.PrimExpr HPQ.PrimExpr () columns')                  (U.Unpackspec columns columns') +{-# DEPRECATED ValuesspecSafe "Use Valuesspec instead.  Will be removed in version 0.9." #-} type ValuesspecSafe = Valuesspec  runValuesspecSafe :: Applicative f@@ -129,16 +131,11 @@                               (HPQ.ConstExpr HPQ.NullLit)  -- Implementing this in terms of Valuesspec for convenience-newtype Nullspec fields fields' = Nullspec (Valuesspec fields fields')+newtype Nullspec fields fields' = Nullspec (Valuesspec Void fields')  nullspecField :: Opaleye.SqlTypes.IsSqlType b               => Nullspec a (Column b)-nullspecField = Nullspec (lmap e valuesspecField)-  where e = error (concat [ "We looked at the argument of a Nullspec when we "-                          , "expected that we never would!  This is a bug in "-                          , "Opaleye.  Please report it, if you can reproduce "-                          , "it."-                          ])+nullspecField = Nullspec (lmap absurd valuesspecField)  nullspecList :: Nullspec a [b] nullspecList = pure []@@ -202,7 +199,7 @@   Nullspec f <*> Nullspec x = Nullspec (f <*> x)  instance Profunctor Nullspec where-  dimap f g (Nullspec q) = Nullspec (dimap f g q)+  dimap _ g (Nullspec q) = Nullspec (fmap g q)  instance ProductProfunctor Nullspec where   purePP = pure
src/Opaleye/Join.hs view
@@ -12,7 +12,6 @@ import qualified Opaleye.Internal.Join as J import qualified Opaleye.Internal.MaybeFields as M import qualified Opaleye.Internal.PrimQuery as PQ-import qualified Opaleye.Internal.Map as Map import qualified Opaleye.Select   as S import qualified Opaleye.SqlTypes as T @@ -43,11 +42,7 @@ -- -- - Full outer joins: use 'Opaleye.FunctionalJoin.fullJoinF' --- | NB Opaleye exports @Opaleye.Table.'Opaleye.Table.optional'@ from--- the top level.  If you want this @optional@ you will have to import--- it from this module.------ Convenient access to lateral left/right join+-- | Convenient access to lateral left/right join -- functionality. Performs a @LATERAL LEFT JOIN@ under the hood and -- has behaviour equivalent to the following Haskell function: --@@ -253,53 +248,3 @@                  -> S.SelectArr i a                  -> S.SelectArr i (M.MaybeFields a) optionalExplicit _ = M.optional---- * Inferrable versions (deprecated)--{-# DEPRECATED leftJoinInferrable "Use 'optionalRestrict' instead." #-}-leftJoinInferrable :: (D.Default U.Unpackspec fieldsL fieldsL,-                       D.Default U.Unpackspec fieldsR fieldsR,-                       D.Default J.NullMaker fieldsR nullableFieldsR,-                       Map.Map J.Nulled fieldsR ~ nullableFieldsR)-                   => S.Select fieldsL-                   -- ^ Left query-                   -> S.Select fieldsR-                   -- ^ Right query-                   -> ((fieldsL, fieldsR) -> F.Field T.SqlBool)-                   -- ^ Condition on which to join-                   -> S.Select (fieldsL, nullableFieldsR)-                   -- ^ Left join-leftJoinInferrable = leftJoin--{-# DEPRECATED rightJoinInferrable "Use 'optionalRestrict' instead." #-}-rightJoinInferrable :: (D.Default U.Unpackspec fieldsL fieldsL,-                        D.Default U.Unpackspec fieldsR fieldsR,-                        D.Default J.NullMaker fieldsL nullableFieldsL,-                        Map.Map J.Nulled fieldsL ~ nullableFieldsL)-                    => S.Select fieldsL-                    -- ^ Left query-                    -> S.Select fieldsR-                    -- ^ Right query-                    -> ((fieldsL, fieldsR) -> F.Field T.SqlBool)-                    -- ^ Condition on which to join-                    -> S.Select (nullableFieldsL, fieldsR)-                    -- ^ Right join-rightJoinInferrable = rightJoin---{-# DEPRECATED fullJoinInferrable "Use 'Opaleye.FunctionalJoin.rightJoinF' instead." #-}-fullJoinInferrable  :: (D.Default U.Unpackspec fieldsL fieldsL,-                        D.Default U.Unpackspec fieldsR fieldsR,-                        D.Default J.NullMaker fieldsL nullableFieldsL,-                        D.Default J.NullMaker fieldsR nullableFieldsR,-                        Map.Map J.Nulled fieldsL ~ nullableFieldsL,-                        Map.Map J.Nulled fieldsR ~ nullableFieldsR)-                    => S.Select fieldsL-                    -- ^ Left query-                    -> S.Select fieldsR-                    -- ^ Right query-                    -> ((fieldsL, fieldsR) -> F.Field T.SqlBool)-                    -- ^ Condition on which to join-                    -> S.Select (nullableFieldsL, nullableFieldsR)-                    -- ^ Full outer join-fullJoinInferrable = fullJoin
src/Opaleye/Manipulation.hs view
@@ -11,22 +11,49 @@ -- generate SQL of the form -- -- @--- INSERT INTO thetable ('John', 1);+-- INSERT INTO thetable (\'John\', 1); -- @ -- -- but not -- -- @ -- INSERT INTO thetable---    SELECT 'John',+--    SELECT \'John\', --    (SELECT num FROM thetable ORDER BY num DESC LIMIT 1) + 1; -- @ -module Opaleye.Manipulation (module Opaleye.Manipulation,+module Opaleye.Manipulation (-- * Insert+                             runInsert,+                             Insert(..),+                             -- * Update+                             runUpdate,+                             Update(..),+                             updateEasy,+                             -- * Delete+                             runDelete,+                             Delete(..),+                             -- * Returning+                             MI.Returning,+                             rCount,+                             rReturning,+                             rReturningI,+                             rReturningExplicit,+                             -- * On conflict                              -- | Currently 'HSql.DoNothing' is the                              -- only conflict action supported by                              -- Opaleye.-                             HSql.OnConflict(..)) where+                             HSql.OnConflict,+                             doNothing,+                             -- * Deprecated+                             runInsert_,+                             runUpdate_,+                             runDelete_,+                             -- ** @DoNothing@+                             -- | Use 'doNothing' instead.+                             -- @DoNothing@ will be deprecated in+                             -- version 0.9.+                             HSql.OnConflict(HSql.DoNothing),+                             ) where  import qualified Opaleye.Field        as F import qualified Opaleye.RunSelect as RS@@ -54,14 +81,14 @@  -- | Run the 'Insert'.  To create an 'Insert' use the 'Insert' -- constructor.-runInsert_ :: PGS.Connection+runInsert  :: PGS.Connection            -- ^            -> Insert haskells            -- ^            -> IO haskells            -- ^ Returns a type that depends on the 'MI.Returning' that            -- you provided when creating the 'Insert'.-runInsert_ conn i = case i of+runInsert conn i = case i of   Insert table_ rows_ returning_ onConflict_ ->     let insert = case (returning_, onConflict_) of           (MI.Count, Nothing) ->@@ -72,41 +99,55 @@             \c t r -> MI.runInsertManyReturningExplicit qr c t r f oc     in insert conn table_ rows_ +-- | Use 'runInsert' instead.  Will be deprecated in 0.9.+runInsert_ :: PGS.Connection+           -> Insert haskells+           -> IO haskells+runInsert_ = runInsert+ -- | Run the 'Update'.  To create an 'Update' use the 'Update' -- constructor.-runUpdate_ :: PGS.Connection+runUpdate  :: PGS.Connection            -- ^            -> Update haskells            -- ^            -> IO haskells            -- ^ Returns a type that depends on the 'MI.Returning' that            -- you provided when creating the 'Update'.-runUpdate_ conn i = case i of-  Update table_ updateWith_ where_ returning_ ->-    let update = case returning_ of+runUpdate  conn i = case i of+  Update table_ updateWith_ where_ returning_ -> case returning_ of           MI.Count ->-            runUpdate+            PGS.execute_ conn (fromString (MI.arrangeUpdateSql table_ updateWith_ where_))           MI.ReturningExplicit qr f ->-            \c t u w -> runUpdateReturningExplicit qr c t u w f-    in update conn table_ updateWith_ where_+            runUpdateReturningExplicit qr conn table_ updateWith_ where_ f +-- | Use 'runUpdate' instead.  Will be deprecated in 0.9.+runUpdate_ :: PGS.Connection+           -> Update haskells+           -> IO haskells+runUpdate_ = runUpdate+ -- | Run the 'Delete'.  To create an 'Delete' use the 'Delete' -- constructor.-runDelete_ :: PGS.Connection+runDelete  :: PGS.Connection            -- ^            -> Delete haskells            -> IO haskells            -- ^ Returns a type that depends on the 'MI.Returning' that            -- you provided when creating the 'Delete'.-runDelete_ conn i = case i of-  Delete table_ where_ returning_ ->-    let delete = case returning_ of+runDelete conn i = case i of+  Delete table_ where_ returning_ -> case returning_ of           MI.Count ->-            runDelete+            PGS.execute_ conn (fromString (MI.arrangeDeleteSql table_ where_))           MI.ReturningExplicit qr f ->-            \c t w -> MI.runDeleteReturningExplicit qr c t w f-    in delete conn table_ where_+            MI.runDeleteReturningExplicit qr conn table_ where_ f +-- | Use 'runDelete' instead.  Will be deprecated in 0.9.+runDelete_ :: PGS.Connection+           -> Delete haskells+           -> IO haskells+runDelete_ = runDelete+ -- * Create a manipulation  data Insert haskells = forall fieldsW fieldsR. Insert@@ -191,7 +232,6 @@ -- * Deprecated versions  -- | Insert rows into a table with @ON CONFLICT DO NOTHING@-{-# DEPRECATED runInsertManyOnConflictDoNothing "Use 'runInsert_'.  Will be removed in version 0.8." #-} runInsertManyOnConflictDoNothing :: PGS.Connection                                  -- ^                                  -> T.Table columns columns'@@ -207,30 +247,6 @@     Just columns' -> (PGS.execute_ conn . fromString .:. MI.arrangeInsertManySql)                          table_ columns' (Just HSql.DoNothing) --- | Insert rows into a table with @ON CONFLICT DO NOTHING@ and--- return a function of the inserted rows------ @runInsertManyReturningOnConflictDoNothing@'s use of the--- 'D.Default' typeclass means that the compiler will have trouble--- inferring types.  It is strongly recommended that you provide full--- type signatures when using it.-{-# DEPRECATED runInsertManyReturningOnConflictDoNothing "Use 'runInsert_'. Will be removed in version 0.8." #-}-runInsertManyReturningOnConflictDoNothing-  :: (D.Default RS.FromFields columnsReturned haskells)-  => PGS.Connection-  -- ^-  -> T.Table columnsW columnsR-  -- ^ Table to insert into-  -> [columnsW]-  -- ^ Rows to insert-  -> (columnsR -> columnsReturned)-  -- ^ Function @f@ to apply to the inserted rows-  -> IO [haskells]-  -- ^ Returned rows after @f@ has been applied-runInsertManyReturningOnConflictDoNothing =-  runInsertManyReturningOnConflictDoNothingExplicit D.def--{-# DEPRECATED runInsertMany "Use 'runInsert_' instead.   Will be removed in version 0.8." #-} runInsertMany :: PGS.Connection               -- ^               -> T.Table columns columns'@@ -244,99 +260,6 @@   Nothing       -> return 0   Just columns' -> (PGS.execute_ conn . fromString .: MI.arrangeInsertManySqlI) t columns' -{-# DEPRECATED runInsertManyReturning "Use 'runInsert_' instead.   Will be removed in version 0.8." #-}-runInsertManyReturning :: (D.Default RS.FromFields columnsReturned haskells)-                       => PGS.Connection-                       -- ^-                       -> T.Table columnsW columnsR-                       -- ^ Table to insert into-                       -> [columnsW]-                       -- ^ Rows to insert-                       -> (columnsR -> columnsReturned)-                       -- ^ Function @f@ to apply to the inserted rows-                       -> IO [haskells]-                       -- ^ Returned rows after @f@ has been applied-runInsertManyReturning = runInsertManyReturningExplicit D.def--{-# DEPRECATED runInsertReturningExplicit "Use 'runInsert_' instead. Will be removed in version 0.8." #-}-runInsertReturningExplicit :: RS.FromFields columnsReturned haskells-                           -> PGS.Connection-                           -> T.Table columnsW columnsR-                           -> columnsW-                           -> (columnsR -> columnsReturned)-                           -> IO [haskells]-runInsertReturningExplicit = MI.runInsertReturningExplicit--{-# DEPRECATED runInsertManyReturningExplicit "Use 'runInsert_' instead.  Will be removed in version 0.8." #-}-runInsertManyReturningExplicit :: RS.FromFields columnsReturned haskells-                               -> PGS.Connection-                               -> T.Table columnsW columnsR-                               -> [columnsW]-                               -> (columnsR -> columnsReturned)-                               -> IO [haskells]-runInsertManyReturningExplicit = MI.runInsertManyReturningExplicitI--{-# DEPRECATED runInsertManyReturningOnConflictDoNothingExplicit "Use 'runInsert_' instead.  Will be removed in version 0.8." #-}-runInsertManyReturningOnConflictDoNothingExplicit-  :: RS.FromFields columnsReturned haskells-  -> PGS.Connection-  -> T.Table columnsW columnsR-  -> [columnsW]-  -> (columnsR -> columnsReturned)-  -> IO [haskells]-runInsertManyReturningOnConflictDoNothingExplicit qr conn t columns f =-  MI.runInsertManyReturningExplicit qr conn t columns f (Just HSql.DoNothing)--{-# DEPRECATED runUpdateEasy "Use 'runUpdate_' instead.  Will be removed in version 0.8." #-}-runUpdateEasy :: D.Default Updater columnsR columnsW-              => PGS.Connection-              -> T.Table columnsW columnsR-              -- ^ Table to update-              -> (columnsR -> columnsR)-              -- ^ Update function to apply to chosen rows-              -> (columnsR -> Column SqlBool)-              -- ^ Predicate function @f@ to choose which rows to update.-              -- 'runUpdate' will update rows for which @f@ returns @TRUE@-              -- and leave unchanged rows for which @f@ returns @FALSE@.-              -> IO Int64-              -- ^ The number of rows updated-runUpdateEasy conn table_ u = runUpdate conn table_ (u' . u)-  where Updater u' = D.def--{-# DEPRECATED runUpdate "Use 'runUpdate_' instead.  Will be removed in version 0.8." #-}-runUpdate :: PGS.Connection-          -> T.Table columnsW columnsR-          -- ^ Table to update-          -> (columnsR -> columnsW)-          -- ^ Update function to apply to chosen rows-          -> (columnsR -> Column SqlBool)-          -- ^ Predicate function @f@ to choose which rows to update.-          -- 'runUpdate' will update rows for which @f@ returns @TRUE@-          -- and leave unchanged rows for which @f@ returns @FALSE@.-          -> IO Int64-          -- ^ The number of rows updated-runUpdate conn = PGS.execute_ conn . fromString .:. MI.arrangeUpdateSql--{-# DEPRECATED runUpdateReturning "Use 'runUpdate_' instead.  Will be removed in version 0.8." #-}-runUpdateReturning :: (D.Default RS.FromFields columnsReturned haskells)-                   => PGS.Connection-                   -- ^-                   -> T.Table columnsW columnsR-                   -- ^ Table to update-                   -> (columnsR -> columnsW)-                   -- ^ Update function to apply to chosen rows-                   -> (columnsR -> Column SqlBool)-                   -- ^ Predicate function @f@ to choose which rows to-                   -- update.  'runUpdate' will update rows for which-                   -- @f@ returns @TRUE@ and leave unchanged rows for-                   -- which @f@ returns @FALSE@.-                   -> (columnsR -> columnsReturned)-                   -- ^ Functon @g@ to apply to the updated rows-                   -> IO [haskells]-                   -- ^ Returned rows after @g@ has been applied-runUpdateReturning = runUpdateReturningExplicit D.def--{-# DEPRECATED runUpdateReturningExplicit "Use 'runUpdate_' instead.  Will be removed in version 0.8." #-} runUpdateReturningExplicit :: RS.FromFields columnsReturned haskells                            -> PGS.Connection                            -> T.Table columnsW columnsR@@ -347,19 +270,9 @@ runUpdateReturningExplicit qr conn t update cond r =   PGS.queryWith_ parser conn                  (fromString (MI.arrangeUpdateReturningSql u t update cond r))-  where IRQ.QueryRunner u _ _ = qr+  where IRQ.FromFields u _ _ = qr         parser = IRQ.prepareRowParser qr (r v)         TI.View v = TI.tableColumnsView (TI.tableColumns t) -{-# DEPRECATED runDelete "Use 'runDelete_' instead.  Will be removed in version 0.8." #-}-runDelete :: PGS.Connection-          -- ^-          -> T.Table a columnsR-          -- ^ Table to delete rows from-          -> (columnsR -> Column SqlBool)-          -- ^ Predicate function @f@ to choose which rows to delete.-          -- 'runDelete' will delete rows for which @f@ returns @TRUE@-          -- and leave unchanged rows for which @f@ returns @FALSE@.-          -> IO Int64-          -- ^ The number of rows deleted-runDelete conn = PGS.execute_ conn . fromString .: MI.arrangeDeleteSql+doNothing :: HSql.OnConflict+doNothing = HSql.DoNothing
− src/Opaleye/Map.hs
@@ -1,4 +0,0 @@-module Opaleye.Map {-# DEPRECATED "This module will be removed in 0.8." #-}-  (module Opaleye.Internal.Map) where--import Opaleye.Internal.Map
src/Opaleye/Operators.hs view
@@ -56,14 +56,12 @@   , upper   , like   , ilike-  , charLength   , sqlLength   -- * Containment operators   , in_   , inSelect   -- * JSON operators   , SqlIsJson-  , PGIsJson   , SqlJsonIndex   , PGJsonIndex   , (.->)@@ -106,9 +104,6 @@   , addInterval   , minusInterval   -- * Deprecated-  , exists-  , notExists-  , inQuery   , keepWhen   ) @@ -125,7 +120,7 @@ import qualified Opaleye.Internal.Column as C import qualified Opaleye.Internal.JSONBuildObjectFields as JBOF import           Opaleye.Internal.QueryArr (SelectArr(QueryArr),-                                            Query, QueryArr, runSimpleQueryArr)+                                            runSimpleQueryArr) import qualified Opaleye.Internal.PrimQuery as PQ import qualified Opaleye.Internal.Operators as O import           Opaleye.Internal.Helpers   ((.:))@@ -281,12 +276,6 @@ ilike :: F.Field T.SqlText -> F.Field T.SqlText -> F.Field T.SqlBool ilike = C.binOp HPQ.OpILike --- {-# DEPRECATED charLength "You probably want to use 'sqlLength' instead" #-}--- | Do not use.  Will be deprecated in 0.8.  You probably want to use--- 'sqlLength' instead.-charLength :: C.PGString a => Column a -> Column Int-charLength (Column e) = Column (HPQ.FunExpr "char_length" [e])- sqlLength :: C.PGString a => F.Field a -> F.Field T.SqlInt4 sqlLength  (Column e) = Column (HPQ.FunExpr "length" [e]) @@ -314,9 +303,6 @@ -- Warning: making additional instances of this class can lead to broken code! class SqlIsJson a -{-# DEPRECATED PGIsJson "Use SqlIsJson instead" #-}-type PGIsJson = SqlIsJson- instance SqlIsJson T.SqlJson instance SqlIsJson T.SqlJsonb @@ -495,32 +481,7 @@ minusInterval :: IntervalNum from to => F.Field from -> F.Field T.SqlInterval -> F.Field to minusInterval = C.binOp (HPQ.:-) -{-# DEPRECATED exists "Identical to 'restrictExists'.  Will be removed in version 0.8." #-}-exists :: QueryArr a b -> QueryArr a ()-exists = restrictExists--{-# DEPRECATED notExists "Identical to 'restrictNotExists'.  Will be removed in version 0.8." #-}-notExists :: QueryArr a b -> QueryArr a ()-notExists = restrictNotExists--{-# DEPRECATED inQuery "Identical to 'inSelect'.  Will be removed in version 0.8." #-}-inQuery :: D.Default O.EqPP fields fields-        => fields -> Query fields -> S.Select (F.Field T.SqlBool)-inQuery = inSelect--{-| This function is probably not useful and is likely to be deprecated-  in the future.--Keep only the rows of a query satisfying a given condition, using-an SQL @WHERE@ clause.--You would typically use 'keepWhen' if you want to write-your query using a "point free" style.  If you want to use 'A.Arrow'-notation then 'restrict' will suit you better.--This is the 'S.SelectArr' equivalent of 'Prelude.filter' from the-'Prelude'.--}+{-# DEPRECATED keepWhen "Use 'where_' or 'restrict' instead.  Will be removed in version 0.9." #-} keepWhen :: (a -> F.Field T.SqlBool) -> S.SelectArr a a keepWhen p = proc a -> do   restrict  -< p a
src/Opaleye/Order.hs view
@@ -16,16 +16,15 @@                      , limit                      , offset                      -- * Distinct on-                     , distinctOnCorrect-                     , distinctOnByCorrect+                     , distinctOn+                     , distinctOnBy                      -- * Exact ordering                      , O.exact                      -- * Other-                     , PGOrd                      , SqlOrd                      -- * Deprecated-                     , distinctOn-                     , distinctOnBy+                     , distinctOnCorrect+                     , distinctOnByCorrect                      ) where  import qualified Data.Profunctor.Product.Default as D@@ -126,27 +125,20 @@  -- * Distinct on --- | Keep a row from each set where the given function returns the same result. No---   ordering is guaranteed. Multiple fields may be distinguished by projecting out---   tuples of 'Opaleye.Field.Field_'s. Use 'distinctOnBy' to control how the rows---   are chosen.+-- | Use 'distinctOn' instead.  Will be deprecated in 0.9. distinctOnCorrect :: D.Default U.Unpackspec b b                   => (a -> b)                   -> S.Select a                   -> S.Select a-distinctOnCorrect proj q = Q.productQueryArr (O.distinctOnCorrect D.def proj . Q.runSimpleQueryArr q)-+distinctOnCorrect proj q = Q.productQueryArr (O.distinctOn D.def proj . Q.runSimpleQueryArr q) --- | Keep the row from each set where the given function returns the same result. The---   row is chosen according to which comes first by the supplied ordering. However, no---   output ordering is guaranteed. Mutliple fields may be distinguished by projecting---   out tuples of 'Opaleye.Field.Field_'s.+-- | Use 'distinctOnBy' instead.  Will be deprecated in 0.9. distinctOnByCorrect :: D.Default U.Unpackspec b b                     => (a -> b)                     -> O.Order a                     -> S.Select a                     -> S.Select a-distinctOnByCorrect proj ord q = Q.productQueryArr (O.distinctOnByCorrect D.def proj ord . Q.runSimpleQueryArr q)+distinctOnByCorrect proj ord q = Q.productQueryArr (O.distinctOnBy D.def proj ord . Q.runSimpleQueryArr q)   -- * Other@@ -154,9 +146,6 @@ -- | Typeclass for Postgres types which support ordering operations. class SqlOrd a where -{-# DEPRECATED PGOrd "Use SqlOrd instead" #-}-type PGOrd = SqlOrd- instance SqlOrd T.SqlBool instance SqlOrd T.SqlDate instance SqlOrd T.SqlFloat8@@ -174,17 +163,17 @@ instance SqlOrd T.SqlUuid instance SqlOrd a => SqlOrd (C.Nullable a) --- | Use 'distinctOnCorrect' instead.  This version has a bug whereby--- it returns the whole query if zero columns are chosen to be--- distinct (it should just return the first row).  Will be deprecated--- in version 0.8.+-- | Keep a row from each set where the given function returns the same result. No+--   ordering is guaranteed. Multiple fields may be distinguished by projecting out+--   tuples of 'Opaleye.Field.Field_'s. Use 'distinctOnBy' to control how the rows+--   are chosen. distinctOn :: D.Default U.Unpackspec b b => (a -> b) -> S.Select a -> S.Select a-distinctOn proj q = Q.productQueryArr (O.distinctOn D.def proj . Q.runSimpleQueryArr q)+distinctOn = distinctOnCorrect --- | Use 'distinctOnByCorrect' instead.  This version has a bug--- whereby it returns the whole query if zero columns are chosen to be--- distinct (it should just return the first row).  Will be deprecated--- in version 0.8.+-- | Keep the row from each set where the given function returns the same result. The+--   row is chosen according to which comes first by the supplied ordering. However, no+--   output ordering is guaranteed. Mutliple fields may be distinguished by projecting+--   out tuples of 'Opaleye.Field.Field_'s. distinctOnBy :: D.Default U.Unpackspec b b => (a -> b) -> O.Order a              -> S.Select a -> S.Select a-distinctOnBy proj ord q = Q.productQueryArr (O.distinctOnBy D.def proj ord . Q.runSimpleQueryArr q)+distinctOnBy = distinctOnByCorrect
− src/Opaleye/PGTypes.hs
@@ -1,4 +0,0 @@-module Opaleye.PGTypes {-# DEPRECATED "Use \"Opaleye.SqlTypes\" instead." #-}-  (module Opaleye.Internal.PGTypesExternal) where--import Opaleye.Internal.PGTypesExternal
− src/Opaleye/QueryArr.hs
@@ -1,3 +0,0 @@-module Opaleye.QueryArr {-# DEPRECATED "Use \"Opaleye.Select\" instead.  This module will be removed in 0.8." #-} (Query, QueryArr) where--import           Opaleye.Internal.QueryArr (QueryArr, Query)
− src/Opaleye/RunQuery.hs
@@ -1,4 +0,0 @@-module Opaleye.RunQuery {-# DEPRECATED "Use \"Opaleye.RunSelect\" instead." #-}-  (module Opaleye.Internal.RunQueryExternal) where--import Opaleye.Internal.RunQueryExternal
src/Opaleye/RunSelect.hs view
@@ -68,7 +68,7 @@           -> IO [haskells] runSelect = RQ.runQuery --- | Will be deprecated in 0.8.  Use 'runSelectI' instead.+{-# DEPRECATED runSelectTF "Use 'runSelectI' instead." #-} runSelectTF :: D.Default FromFields (rec TF.O) (rec TF.H)             => PGS.Connection             -- ^@@ -130,9 +130,10 @@ -- -- @ -- newtype Foo = Foo Int+-- data SqlFoo ----- instance DefaultFromField Foo Foo where---    defaultFromField = unsafeFromField Foo defaultFromField+-- instance 'IRQ.DefaultFromField' SqlFoo Foo where+--    'IRQ.defaultFromField' = unsafeFromField Foo defaultFromField -- @ -- -- It is \"unsafe\" because it does not check that the @sqlType@@@ -140,11 +141,8 @@ unsafeFromField :: (b -> b')                 -> IRQ.FromField sqlType b                 -> IRQ.FromField sqlType' b'-unsafeFromField haskellF qrc = IRQ.QueryRunnerColumn (P.lmap colF u)-                                                     (fmapFP haskellF fp)-  where IRQ.QueryRunnerColumn u fp = qrc-        fmapFP = fmap . fmap . fmap-        colF = C.unsafeCoerceColumn+unsafeFromField haskellF (IRQ.FromField u fp) =+  fmap haskellF (IRQ.FromField (P.lmap (C.unsafeCoerceColumn) u) fp)  runSelectExplicit :: FromFields fields haskells                   -> PGS.Connection
src/Opaleye/Sql.hs view
@@ -7,11 +7,6 @@   -- * Explicit versions   showSqlExplicit,   showSqlUnoptExplicit,-  -- * Deprecated functions-  showSqlForPostgres,-  showSqlForPostgresUnopt,-  showSqlForPostgresExplicit,-  showSqlForPostgresUnoptExplicit,   ) where  import qualified Opaleye.Internal.Unpackspec as U@@ -59,21 +54,3 @@  showSqlUnoptExplicit :: U.Unpackspec fields b -> S.Select fields -> Maybe String showSqlUnoptExplicit = Pr.formatAndShowSQL .: Q.runQueryArrUnpack--{-# DEPRECATED showSqlForPostgres "Will be removed in version 0.8.  Use 'showSql' instead." #-}-showSqlForPostgres :: forall columns . D.Default U.Unpackspec columns columns =>-                      S.Select columns -> Maybe String-showSqlForPostgres = showSql--{-# DEPRECATED showSqlForPostgresUnopt "Will be removed in version 0.8.  Use 'showSqlUnopt' instead." #-}-showSqlForPostgresUnopt :: forall columns . D.Default U.Unpackspec columns columns =>-                           S.Select columns -> Maybe String-showSqlForPostgresUnopt = showSqlUnopt--{-# DEPRECATED showSqlForPostgresExplicit "Will be removed in version 0.8.  Use 'showSqlExplicit' instead." #-}-showSqlForPostgresExplicit :: U.Unpackspec columns b -> S.Select columns -> Maybe String-showSqlForPostgresExplicit = showSqlExplicit--{-# DEPRECATED showSqlForPostgresUnoptExplicit "Will be removed in version 0.8.  Use 'showSqlUnoptExplicit' instead." #-}-showSqlForPostgresUnoptExplicit :: U.Unpackspec columns b -> S.Select columns -> Maybe String-showSqlForPostgresUnoptExplicit = showSqlUnoptExplicit
src/Opaleye/SqlTypes.hs view
@@ -82,9 +82,7 @@   SqlUuid,   SqlBytea,   -- * @IsSqlType@-  P.IsSqlType,-  -- * Entire module-  module Opaleye.SqlTypes,+  P.IsSqlType(P.showSqlType),   ) where  import qualified Opaleye.Field   as F
src/Opaleye/Table.hs view
@@ -71,25 +71,14 @@                       -- * Selecting from tables                       selectTable,                       -- * Data types-                      T.TableColumns,                       TableFields,                       -- * Explicit versions                       selectTableExplicit,-                      -- * Deprecated-                      T.optional,-                      T.readOnly,-                      T.required,-                      T.tableColumn,-                      View,-                      Writer,-                      T.Table(T.Table, T.TableWithSchema),-                      queryTable,-                      queryTableExplicit) where+                     ) where  import qualified Opaleye.Internal.QueryArr as Q import qualified Opaleye.Internal.Table as T-import           Opaleye.Internal.Table (View, Table, Writer,-                                         TableFields)+import           Opaleye.Internal.Table (Table, TableFields)  import qualified Opaleye.Internal.Tag as Tag import qualified Opaleye.Internal.Unpackspec as U@@ -144,15 +133,3 @@ selectTableExplicit cm table' = Q.productQueryArr f where   f ((), t0) = (retwires, primQ, Tag.next t0) where     (retwires, primQ) = T.queryTable cm table' t0---- * Deprecated versions--{-# DEPRECATED queryTable "Use 'selectTable' instead.  Will be removed in version 0.8." #-}-queryTable :: D.Default U.Unpackspec fields fields =>-              Table a fields -> S.Select fields-queryTable = selectTable--{-# DEPRECATED queryTableExplicit "Use 'selectTableExplicit' instead.  Will be removed in version 0.8." #-}-queryTableExplicit :: U.Unpackspec tablefields fields ->-                     Table a tablefields -> S.Select fields-queryTableExplicit = selectTableExplicit
src/Opaleye/TypeFamilies.hs view
@@ -1,6 +1,4 @@--- | Will be deprecated in 0.8.--module Opaleye.TypeFamilies+module Opaleye.TypeFamilies {-# DEPRECATED "No longer supported" #-}   ( TF.TableRecordField   , TF.RecordField   , (TF.:<*>)@@ -17,7 +15,6 @@   , TF.Opt   , TF.Req   , TF.Nulls-  , TF.TableField   ) where  import Opaleye.Internal.TypeFamilies as TF
src/Opaleye/Values.hs view
@@ -6,13 +6,13 @@   valuesExplicit,   -- * Adaptors   V.Valuesspec,-  V.ValuesspecSafe,   V.valuesspecField,   -- * Deprecated versions   valuesSafe,   valuesSafeExplicit,   valuesUnsafe,   valuesUnsafeExplicit,+  V.ValuesspecSafe,   ) where  import qualified Opaleye.Internal.QueryArr as Q@@ -22,13 +22,13 @@  import           Data.Profunctor.Product.Default (Default, def) --- | Do not use.  Will be deprecated in 0.8.+{-# DEPRECATED valuesUnsafe "Use 'values' instead.  Will be removed in 0.9." #-} valuesUnsafe :: (Default V.ValuesspecUnsafe fields fields,                  Default U.Unpackspec fields fields) =>                 [fields] -> S.Select fields valuesUnsafe = valuesUnsafeExplicit def def --- | Do not use.  Will be deprecated in 0.8.+{-# DEPRECATED valuesUnsafeExplicit "Use 'values' instead.  Will be removed in 0.9." #-} valuesUnsafeExplicit :: U.Unpackspec fields fields'                      -> V.ValuesspecUnsafe fields fields'                      -> [fields] -> S.Select fields'@@ -59,12 +59,12 @@ valuesExplicit valuesspec fields =   Q.productQueryArr (V.valuesUSafe valuesspec fields) --- | Use 'values' instead.  Will be deprecated in 0.8.+{-# DEPRECATED valuesSafe "Use 'values' instead.  Will be removed in 0.9." #-} valuesSafe :: Default V.Valuesspec fields fields            => [fields] -> S.Select fields valuesSafe = values --- | Use 'valuesExplicit' instead.  Will be deprecated in 0.8.+{-# DEPRECATED valuesSafeExplicit "Use 'values' instead.  Will be removed in 0.9." #-} valuesSafeExplicit :: V.Valuesspec fields fields'                    -> [fields] -> S.Select fields' valuesSafeExplicit = valuesExplicit