From 57a12e68727c027f0f1c25752f8c5704ddbe1516 Mon Sep 17 00:00:00 2001 From: Edsko de Vries Date: Thu, 19 Aug 2021 12:22:45 +0200 Subject: [PATCH] Export generic classes `beam` relies very heavily on GHC generics, but the standard GHC generic instances are not appropriate for all use cases (motivating example in this case being [`large-records`](https://hackage.haskell.org/package/large-records)). Fortunately, the way GHC generics is set up allows us to use non-standard representations, _provided_ that we can then define additional instances for whatever generic classes are necessary. The [`beam-large-records`](https://github.com/well-typed/beam-large-records) library provides integration for `large-records` with `beam-core`, by providing these additional instances, but this does mean that the generic classes must be _exported_ from `beam-core` so that additional instances can be provided. This commit adds these exports. --- beam-core/Database/Beam/Backend/SQL/Row.hs | 3 +++ beam-core/Database/Beam/Schema/Lenses.hs | 7 ++++++- beam-core/Database/Beam/Schema/Tables.hs | 15 ++++++++++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/beam-core/Database/Beam/Backend/SQL/Row.hs b/beam-core/Database/Beam/Backend/SQL/Row.hs index 28401cce..c4ff46e8 100644 --- a/beam-core/Database/Beam/Backend/SQL/Row.hs +++ b/beam-core/Database/Beam/Backend/SQL/Row.hs @@ -13,6 +13,9 @@ module Database.Beam.Backend.SQL.Row , ColumnParseError(..), BeamRowReadError(..) , FromBackendRow(..) + + -- * Exported so we can override defaults + , GFromBackendRow(..) -- for 'runSelectReturningList' and co ) where import Database.Beam.Backend.SQL.Types diff --git a/beam-core/Database/Beam/Schema/Lenses.hs b/beam-core/Database/Beam/Schema/Lenses.hs index b46f15ee..41452901 100644 --- a/beam-core/Database/Beam/Schema/Lenses.hs +++ b/beam-core/Database/Beam/Schema/Lenses.hs @@ -4,7 +4,12 @@ module Database.Beam.Schema.Lenses ( tableLenses , TableLens(..) - , dbLenses ) where + , dbLenses + + -- * Exported so we can override defaults + , GTableLenses(..) + , GDatabaseLenses(..) + ) where import Database.Beam.Schema.Tables diff --git a/beam-core/Database/Beam/Schema/Tables.hs b/beam-core/Database/Beam/Schema/Tables.hs index 90ef2d39..ebb7f675 100644 --- a/beam-core/Database/Beam/Schema/Tables.hs +++ b/beam-core/Database/Beam/Schema/Tables.hs @@ -57,7 +57,20 @@ module Database.Beam.Schema.Tables , pk , allBeamValues, changeBeamRep , alongsideTable - , defaultFieldName ) + , defaultFieldName + + -- * Exported so we can override defaults + -- For 'Beamable' + , GZipTables(..) + , GTableSkeleton(..) + -- For 'Database' + , GZipDatabase(..) + -- for 'defaultDbSettings' + , GAutoDbSettings(..) + , GDefaultTableFieldSettings(..) + , ChooseSubTableStrategy + , SubTableStrategyImpl + ) where import Database.Beam.Backend.Types