Skip to content

Commit 61e80c3

Browse files
committed
Reduced CPP usage to minimum
1 parent a3b195a commit 61e80c3

29 files changed

Lines changed: 20 additions & 92 deletions

File tree

beam-core/Database/Beam/Backend/SQL/Builder.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
2-
{-# LANGUAGE CPP #-}
32
{-# LANGUAGE PolyKinds #-}
43
{-# LANGUAGE UndecidableInstances #-}
54

beam-core/Database/Beam/Backend/SQL/Row.hs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{-# OPTIONS_GHC -fno-warn-orphans #-}
22
{-# LANGUAGE CPP #-}
33
{-# LANGUAGE UndecidableInstances #-}
4-
{-# LANGUAGE FunctionalDependencies #-}
54
{-# LANGUAGE ConstraintKinds #-}
65
{-# LANGUAGE LambdaCase #-}
76
{-# LANGUAGE PolyKinds #-}
@@ -86,9 +85,7 @@ instance Alternative (FromBackendRowM be) where
8685
FromBackendRowM (liftF (Alt a b id))
8786

8887
parseOneField :: (BackendFromField be a, Typeable a) => FromBackendRowM be a
89-
parseOneField = do
90-
x <- FromBackendRowM (liftF (ParseOneField id))
91-
pure x
88+
parseOneField = FromBackendRowM (liftF (ParseOneField id))
9289

9390
peekField :: (Typeable a, BackendFromField be a) => FromBackendRowM be (Maybe a)
9491
peekField = fmap Just (FromBackendRowM (liftF (ParseOneField id))) <|> pure Nothing

beam-core/Database/Beam/Backend/URI.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
{-# LANGUAGE CPP #-}
2-
31
-- | Convenience methods for constructing backend-agnostic applications
42
module Database.Beam.Backend.URI where
53

beam-core/Database/Beam/Query/CTE.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{-# LANGUAGE AllowAmbiguousTypes #-}
22
{-# LANGUAGE UndecidableInstances #-}
3-
{-# LANGUAGE CPP #-}
43

54
module Database.Beam.Query.CTE where
65

beam-core/Database/Beam/Query/Combinators.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{-# LANGUAGE CPP #-}
21
{-# LANGUAGE UndecidableInstances #-}
32

43
module Database.Beam.Query.Combinators

beam-core/Database/Beam/Query/CustomSQL.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{-# LANGUAGE FunctionalDependencies #-}
22
{-# LANGUAGE UndecidableInstances #-}
3-
{-# LANGUAGE CPP #-}
43

54
-- | Allows the creation of custom SQL expressions from arbitrary string-like values.
65
--

beam-core/Database/Beam/Query/SQL92.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-unused-binds #-}
22
{-# LANGUAGE UndecidableInstances #-}
33
{-# LANGUAGE ScopedTypeVariables #-}
4-
{-# LANGUAGE CPP #-}
54

65
module Database.Beam.Query.SQL92
76
( buildSql92Query' ) where

beam-core/Database/Beam/Schema/Tables.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{-# LANGUAGE CPP #-}
21
{-# LANGUAGE UndecidableInstances #-}
32
{-# LANGUAGE ConstraintKinds #-}
43
{-# LANGUAGE TypeApplications #-}

beam-migrate/ChangeLog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# 0.6.1.0
2+
3+
## Updated dependencies
4+
5+
* Tightened bounds on `haskell-src-exts`, with a minimum version of 1.23.
6+
* Tightened bounds on `hashable`, with a minimum version of 1.4.
7+
* Tightened bounds on `aeson`, with a minimum of version 2.0.
8+
19
# 0.6.0.0
210

311
## Interface changes

beam-migrate/Database/Beam/Haskell/Syntax.hs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{-# OPTIONS_GHC -fno-warn-orphans #-}
22
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
3-
{-# LANGUAGE CPP #-}
43

54
-- | Instances that allow us to use Haskell as a backend syntax. This allows us
65
-- to use migrations defined a la 'Database.Beam.Migrate.SQL' to generate a beam
@@ -209,33 +208,21 @@ entityDbFieldName entity = "_" ++ getHsEntityName (hsEntityName entity)
209208

210209
derivingDecl :: [Hs.InstRule ()] -> Hs.Deriving ()
211210
derivingDecl =
212-
#if MIN_VERSION_haskell_src_exts(1,20,0)
213211
Hs.Deriving () Nothing
214-
#else
215-
Hs.Deriving ()
216-
#endif
217212

218213
dataDecl :: Hs.DeclHead ()
219214
-> [Hs.QualConDecl ()]
220215
-> Maybe (Hs.Deriving ())
221216
-> Hs.Decl ()
222217
dataDecl declHead cons deriving_ =
223-
#if MIN_VERSION_haskell_src_exts(1,20,0)
224218
Hs.DataDecl () (Hs.DataType ()) Nothing declHead cons (maybeToList deriving_)
225-
#else
226-
Hs.DataDecl () (Hs.DataType ()) Nothing declHead cons deriving_
227-
#endif
228219

229220
insDataDecl :: Hs.Type ()
230221
-> [Hs.QualConDecl ()]
231222
-> Maybe (Hs.Deriving ())
232223
-> Hs.InstDecl ()
233224
insDataDecl declHead cons deriving_ =
234-
#if MIN_VERSION_haskell_src_exts(1,20,0)
235225
Hs.InsData () (Hs.DataType ()) declHead cons (maybeToList deriving_)
236-
#else
237-
Hs.InsData () (Hs.DataType ()) declHead cons deriving_
238-
#endif
239226

240227
databaseTypeDecl :: [ HsEntity ] -> Hs.Decl ()
241228
databaseTypeDecl entities =
@@ -950,11 +937,7 @@ hsInstance classNm params decls =
950937

951938
hsDerivingInstance :: T.Text -> [ Hs.Type () ] -> Hs.Decl ()
952939
hsDerivingInstance classNm params =
953-
#if MIN_VERSION_haskell_src_exts(1,20,0)
954940
Hs.DerivDecl () Nothing Nothing (Hs.IRule () Nothing Nothing instHead)
955-
#else
956-
Hs.DerivDecl () Nothing (Hs.IRule () Nothing Nothing instHead)
957-
#endif
958941
where
959942
instHead = foldl (Hs.IHApp ()) (Hs.IHCon () (Hs.UnQual () (Hs.Ident () (T.unpack classNm)))) params
960943

@@ -974,11 +957,7 @@ inst = Hs.IRule () Nothing Nothing . Hs.IHCon () . Hs.UnQual () . Hs.Ident ()
974957
beamMigrateSqlBackend :: HsBackendConstraint
975958
beamMigrateSqlBackend =
976959
HsBackendConstraint $ \beTy ->
977-
#if MIN_VERSION_haskell_src_exts(1, 22, 0)
978960
Hs.TypeA () (Hs.TyApp () (Hs.TyCon () (Hs.UnQual () (Hs.Ident () "BeamMigrateSqlBackend"))) beTy)
979-
#else
980-
Hs.ClassA () (Hs.UnQual () (Hs.Ident () "BeamMigrateSqlBackend")) [ beTy ]
981-
#endif
982961

983962

984963

@@ -991,12 +970,9 @@ instance Hashable (Hs.IPName ())
991970
instance Hashable (Hs.Asst ())
992971
instance Hashable (Hs.Literal ())
993972
instance Hashable (Hs.Name ())
994-
instance Hashable (Hs.Type ())
995973
instance Hashable (Hs.QOp ())
996974
instance Hashable (Hs.TyVarBind ())
997-
#if !MIN_VERSION_haskell_src_exts(1, 21, 0)
998975
instance Hashable (Hs.Kind ())
999-
#endif
1000976
instance Hashable (Hs.Context ())
1001977
instance Hashable (Hs.SpecialCon ())
1002978
instance Hashable (Hs.Pat ())
@@ -1053,11 +1029,5 @@ instance Hashable (Hs.BangType ())
10531029
instance Hashable (Hs.ImportSpec ())
10541030
instance Hashable (Hs.Namespace ())
10551031
instance Hashable (Hs.CName ())
1056-
#if MIN_VERSION_haskell_src_exts(1,20,0)
10571032
instance Hashable (Hs.DerivStrategy ())
10581033
instance Hashable (Hs.MaybePromotedName ())
1059-
#endif
1060-
#if !MIN_VERSION_hashable(1, 3, 4)
1061-
instance Hashable a => Hashable (S.Set a) where
1062-
hashWithSalt s a = hashWithSalt s (S.toList a)
1063-
#endif

0 commit comments

Comments
 (0)