mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +03:00
Reject MonadUnique
, embrace IO
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7751 GitOrigin-RevId: 3edc4dee10d58afac911c9862e3b55a4c458a293
This commit is contained in:
parent
c663cb9879
commit
e41654b133
@ -297,7 +297,6 @@ common lib-depends
|
|||||||
, lifted-base
|
, lifted-base
|
||||||
, monad-control
|
, monad-control
|
||||||
, monad-loops
|
, monad-loops
|
||||||
, monad-unique
|
|
||||||
, monad-validate
|
, monad-validate
|
||||||
, mtl
|
, mtl
|
||||||
, nonempty-containers
|
, nonempty-containers
|
||||||
|
@ -32,7 +32,6 @@ library
|
|||||||
, dependent-map
|
, dependent-map
|
||||||
, dependent-sum
|
, dependent-sum
|
||||||
, hasura-prelude
|
, hasura-prelude
|
||||||
, monad-unique
|
|
||||||
, profunctors
|
, profunctors
|
||||||
, reflection
|
, reflection
|
||||||
, some
|
, some
|
||||||
@ -89,7 +88,6 @@ test-suite hasura-incremental-tests
|
|||||||
, hasura-incremental
|
, hasura-incremental
|
||||||
, hasura-prelude
|
, hasura-prelude
|
||||||
, hspec
|
, hspec
|
||||||
, monad-unique
|
|
||||||
, unordered-containers
|
, unordered-containers
|
||||||
|
|
||||||
build-tool-depends:
|
build-tool-depends:
|
||||||
|
@ -8,7 +8,6 @@ module Hasura.Incremental.Internal.Cache
|
|||||||
where
|
where
|
||||||
|
|
||||||
import Control.Arrow.Extended
|
import Control.Arrow.Extended
|
||||||
import Control.Monad.Unique
|
|
||||||
import Data.Reflection
|
import Data.Reflection
|
||||||
import Hasura.Incremental.Internal.Dependency
|
import Hasura.Incremental.Internal.Dependency
|
||||||
import Hasura.Incremental.Internal.Rule
|
import Hasura.Incremental.Internal.Rule
|
||||||
@ -55,7 +54,7 @@ instance (Monoid w, ArrowCache m arr) => ArrowCache m (WriterA w arr) where
|
|||||||
dependOn = liftA dependOn
|
dependOn = liftA dependOn
|
||||||
{-# INLINE dependOn #-}
|
{-# INLINE dependOn #-}
|
||||||
|
|
||||||
instance (MonadUnique m) => ArrowCache m (Rule m) where
|
instance MonadIO m => ArrowCache m (Rule m) where
|
||||||
cache ::
|
cache ::
|
||||||
forall a b.
|
forall a b.
|
||||||
(Given Accesses => Eq a) =>
|
(Given Accesses => Eq a) =>
|
||||||
|
@ -296,7 +296,7 @@ class (Arrow arr) => ArrowDistribute arr where
|
|||||||
-- This is intended to be used as a control operator in @proc@ notation; see
|
-- This is intended to be used as a control operator in @proc@ notation; see
|
||||||
-- Note [Weird control operator types] in "Control.Arrow.Extended".
|
-- Note [Weird control operator types] in "Control.Arrow.Extended".
|
||||||
keyed ::
|
keyed ::
|
||||||
(Eq k, Hashable k) =>
|
Hashable k =>
|
||||||
arr (e, (k, (a, s))) b ->
|
arr (e, (k, (a, s))) b ->
|
||||||
arr (e, (HashMap k a, s)) (HashMap k b)
|
arr (e, (HashMap k a, s)) (HashMap k b)
|
||||||
|
|
||||||
|
@ -19,13 +19,13 @@ module Hasura.Incremental.Select
|
|||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
import Control.Monad.Unique
|
|
||||||
import Data.Dependent.Map qualified as DM
|
import Data.Dependent.Map qualified as DM
|
||||||
import "some" Data.GADT.Compare
|
import "some" Data.GADT.Compare
|
||||||
import Data.HashMap.Strict qualified as M
|
import Data.HashMap.Strict qualified as M
|
||||||
import Data.Kind
|
import Data.Kind
|
||||||
import Data.Proxy (Proxy (..))
|
import Data.Proxy (Proxy (..))
|
||||||
import Data.Type.Equality
|
import Data.Type.Equality
|
||||||
|
import Data.Unique (Unique, newUnique)
|
||||||
import GHC.OverloadedLabels (IsLabel (..))
|
import GHC.OverloadedLabels (IsLabel (..))
|
||||||
import GHC.Records (HasField (..))
|
import GHC.Records (HasField (..))
|
||||||
import GHC.TypeLits (KnownSymbol, sameSymbol, symbolVal)
|
import GHC.TypeLits (KnownSymbol, sameSymbol, symbolVal)
|
||||||
@ -137,8 +137,8 @@ type role UniqueS nominal
|
|||||||
newtype UniqueS a = UniqueS Unique
|
newtype UniqueS a = UniqueS Unique
|
||||||
deriving (Eq)
|
deriving (Eq)
|
||||||
|
|
||||||
newUniqueS :: (MonadUnique m) => m (UniqueS a)
|
newUniqueS :: MonadIO m => m (UniqueS a)
|
||||||
newUniqueS = UniqueS <$> newUnique
|
newUniqueS = UniqueS <$> liftIO newUnique
|
||||||
{-# INLINE newUniqueS #-}
|
{-# INLINE newUniqueS #-}
|
||||||
|
|
||||||
instance GEq UniqueS where
|
instance GEq UniqueS where
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
cabal-version: 2.2
|
|
||||||
name: monad-unique
|
|
||||||
version: 1.0.0
|
|
||||||
build-type: Simple
|
|
||||||
copyright: Hasura Inc.
|
|
||||||
extra-source-files: README.md
|
|
||||||
|
|
||||||
library
|
|
||||||
hs-source-dirs: src
|
|
||||||
default-language: GHC2021
|
|
||||||
|
|
||||||
ghc-options:
|
|
||||||
-- Taken from https://medium.com/mercury-bank/enable-all-the-warnings-a0517bc081c3
|
|
||||||
-Weverything
|
|
||||||
-Wno-missing-exported-signatures
|
|
||||||
-Wno-missing-import-lists
|
|
||||||
-Wno-missed-specialisations
|
|
||||||
-Wno-all-missed-specialisations
|
|
||||||
-Wno-unsafe
|
|
||||||
-Wno-safe
|
|
||||||
-Wno-missing-local-signatures
|
|
||||||
-Wno-monomorphism-restriction
|
|
||||||
-Wno-missing-kind-signatures
|
|
||||||
-Wno-missing-safe-haskell-mode
|
|
||||||
-- We want these warnings, but the code doesn't satisfy them yet:
|
|
||||||
-Wno-missing-deriving-strategies
|
|
||||||
-Wno-unused-packages
|
|
||||||
|
|
||||||
build-depends:
|
|
||||||
, base
|
|
||||||
, mtl
|
|
||||||
, transformers
|
|
||||||
|
|
||||||
exposed-modules:
|
|
||||||
Control.Monad.Unique
|
|
@ -1,31 +0,0 @@
|
|||||||
-- | A tiny mtl-style wrapper around 'U.newUnique'.
|
|
||||||
module Control.Monad.Unique
|
|
||||||
( U.Unique,
|
|
||||||
MonadUnique (..),
|
|
||||||
)
|
|
||||||
where
|
|
||||||
|
|
||||||
import Control.Monad.Except (ExceptT)
|
|
||||||
import Control.Monad.Reader (ReaderT)
|
|
||||||
import Control.Monad.State.Strict (StateT)
|
|
||||||
import Control.Monad.Trans.Class (lift)
|
|
||||||
import Control.Monad.Writer.Strict (WriterT)
|
|
||||||
import Data.Unique qualified as U
|
|
||||||
|
|
||||||
class (Monad m) => MonadUnique m where
|
|
||||||
newUnique :: m U.Unique
|
|
||||||
|
|
||||||
instance MonadUnique IO where
|
|
||||||
newUnique = U.newUnique
|
|
||||||
|
|
||||||
instance (MonadUnique m) => MonadUnique (ExceptT e m) where
|
|
||||||
newUnique = lift newUnique
|
|
||||||
|
|
||||||
instance (MonadUnique m) => MonadUnique (ReaderT r m) where
|
|
||||||
newUnique = lift newUnique
|
|
||||||
|
|
||||||
instance (MonadUnique m) => MonadUnique (StateT s m) where
|
|
||||||
newUnique = lift newUnique
|
|
||||||
|
|
||||||
instance (Monoid w, MonadUnique m) => MonadUnique (WriterT w m) where
|
|
||||||
newUnique = lift newUnique
|
|
@ -48,7 +48,6 @@ import Control.Arrow.Extended
|
|||||||
import Control.Arrow.Interpret
|
import Control.Arrow.Interpret
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Control.Monad.Trans.Control (MonadBaseControl)
|
import Control.Monad.Trans.Control (MonadBaseControl)
|
||||||
import Control.Monad.Unique
|
|
||||||
import Data.Aeson.Extended
|
import Data.Aeson.Extended
|
||||||
import Data.HashMap.Strict.Extended qualified as M
|
import Data.HashMap.Strict.Extended qualified as M
|
||||||
import Data.HashMap.Strict.InsOrd qualified as OMap
|
import Data.HashMap.Strict.InsOrd qualified as OMap
|
||||||
@ -270,8 +269,7 @@ newtype CacheBuild a = CacheBuild (ReaderT CacheBuildParams (ExceptT QErr IO) a)
|
|||||||
MonadReader CacheBuildParams,
|
MonadReader CacheBuildParams,
|
||||||
MonadIO,
|
MonadIO,
|
||||||
MonadBase IO,
|
MonadBase IO,
|
||||||
MonadBaseControl IO,
|
MonadBaseControl IO
|
||||||
MonadUnique
|
|
||||||
)
|
)
|
||||||
|
|
||||||
instance HasHttpManagerM CacheBuild where
|
instance HasHttpManagerM CacheBuild where
|
||||||
|
Loading…
Reference in New Issue
Block a user