From 70515d94c7cebc1edeac4a46400e76a778d2acb4 Mon Sep 17 00:00:00 2001 From: Tom Harding Date: Fri, 9 Sep 2022 14:56:54 +0100 Subject: [PATCH] Extract Hasura.Prelude from `src-lib` PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5776 GitOrigin-RevId: 0df263a4d800e694e68e31c189c360c88cf48abc --- server/graphql-engine.cabal | 5 ++-- .../lib/hasura-prelude/hasura-prelude.cabal | 30 +++++++++++++++++++ .../src}/Data/Time/Clock/Units.hs | 9 ++++++ .../hasura-prelude/src}/Hasura/Prelude.hs | 3 ++ 4 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 server/lib/hasura-prelude/hasura-prelude.cabal rename server/{src-lib => lib/hasura-prelude/src}/Data/Time/Clock/Units.hs (95%) rename server/{src-lib => lib/hasura-prelude/src}/Hasura/Prelude.hs (99%) diff --git a/server/graphql-engine.cabal b/server/graphql-engine.cabal index 0455dec459d..8c5f6d0e254 100644 --- a/server/graphql-engine.cabal +++ b/server/graphql-engine.cabal @@ -159,6 +159,7 @@ common lib-depends , free , hashable , hasura-error-message + , hasura-prelude , hasura-schema-parsers , http-client-tls , http-conduit @@ -420,7 +421,6 @@ library , Data.Text.Casing , Data.Text.Extended , Data.Text.NonEmpty - , Data.Time.Clock.Units , Data.Trie , Data.URL.Template , Database.MSSQL.Transaction @@ -634,7 +634,6 @@ library , Hasura.Server.Types , Hasura.Server.Utils , Hasura.Server.Version - , Hasura.Prelude , Hasura.EncJSON , Hasura.GraphQL.Execute.Query @@ -905,6 +904,7 @@ executable graphql-engine , bytestring , ekg-core , ekg-prometheus + , hasura-prelude , kan-extensions , pg-client , text @@ -1136,6 +1136,7 @@ test-suite tests-hspec , graphql-engine , graphql-parser , haskell-src-meta + , hasura-prelude , hedgehog , hspec , hspec >=2.8.3 && <3 diff --git a/server/lib/hasura-prelude/hasura-prelude.cabal b/server/lib/hasura-prelude/hasura-prelude.cabal new file mode 100644 index 00000000000..98e6abbccd2 --- /dev/null +++ b/server/lib/hasura-prelude/hasura-prelude.cabal @@ -0,0 +1,30 @@ +cabal-version: 3.0 +name: hasura-prelude +version: 0.1.0.0 + +library + hs-source-dirs: src + build-depends: + aeson, + aeson-casing, + base, + base64-bytestring, + bytestring, + containers, + deepseq, + hashable, + insert-ordered-containers, + lens, + mtl, + nonempty-containers, + pretty-simple, + text, + time, + transformers, + transformers-base, + unordered-containers, + witherable + default-language: Haskell2010 + exposed-modules: + Data.Time.Clock.Units + Hasura.Prelude diff --git a/server/src-lib/Data/Time/Clock/Units.hs b/server/lib/hasura-prelude/src/Data/Time/Clock/Units.hs similarity index 95% rename from server/src-lib/Data/Time/Clock/Units.hs rename to server/lib/hasura-prelude/src/Data/Time/Clock/Units.hs index 816fc29fe05..74602e92085 100644 --- a/server/src-lib/Data/Time/Clock/Units.hs +++ b/server/lib/hasura-prelude/src/Data/Time/Clock/Units.hs @@ -1,4 +1,13 @@ +{-# LANGUAGE AllowAmbiguousTypes #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DerivingVia #-} +{-# LANGUAGE GeneralisedNewtypeDeriving #-} +{-# LANGUAGE ImportQualifiedPost #-} +{-# LANGUAGE KindSignatures #-} {-# LANGUAGE NumDecimals #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} -- | Types for time intervals of various units. Each newtype wraps 'DiffTime', -- but they have different 'Num' instances. The intent is to use the record diff --git a/server/src-lib/Hasura/Prelude.hs b/server/lib/hasura-prelude/src/Hasura/Prelude.hs similarity index 99% rename from server/src-lib/Hasura/Prelude.hs rename to server/lib/hasura-prelude/src/Hasura/Prelude.hs index b1afcf8fc41..ea5be23ff93 100644 --- a/server/src-lib/Hasura/Prelude.hs +++ b/server/lib/hasura-prelude/src/Hasura/Prelude.hs @@ -1,3 +1,6 @@ +{-# LANGUAGE BangPatterns #-} +{-# LANGUAGE ImportQualifiedPost #-} +{-# LANGUAGE LambdaCase #-} {-# OPTIONS_GHC -fno-warn-orphans #-} {-# OPTIONS_GHC -fno-warn-redundant-constraints #-}