module Hasura.GraphQL.Schema.Typename
( MkTypename (..),
withTypenameCustomization,
mkTypename,
)
where
import Control.Lens (set)
import Data.Has (Has (..))
import Data.Monoid (Endo (..))
import Hasura.Prelude
import Language.GraphQL.Draft.Syntax (Name)
newtype MkTypename = MkTypename {MkTypename -> Name -> Name
runMkTypename :: Name -> Name}
deriving (b -> MkTypename -> MkTypename
NonEmpty MkTypename -> MkTypename
MkTypename -> MkTypename -> MkTypename
(MkTypename -> MkTypename -> MkTypename)
-> (NonEmpty MkTypename -> MkTypename)
-> (forall b. Integral b => b -> MkTypename -> MkTypename)
-> Semigroup MkTypename
forall b. Integral b => b -> MkTypename -> MkTypename
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
stimes :: b -> MkTypename -> MkTypename
$cstimes :: forall b. Integral b => b -> MkTypename -> MkTypename
sconcat :: NonEmpty MkTypename -> MkTypename
$csconcat :: NonEmpty MkTypename -> MkTypename
<> :: MkTypename -> MkTypename -> MkTypename
$c<> :: MkTypename -> MkTypename -> MkTypename
Semigroup, Semigroup MkTypename
MkTypename
Semigroup MkTypename
-> MkTypename
-> (MkTypename -> MkTypename -> MkTypename)
-> ([MkTypename] -> MkTypename)
-> Monoid MkTypename
[MkTypename] -> MkTypename
MkTypename -> MkTypename -> MkTypename
forall a.
Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
mconcat :: [MkTypename] -> MkTypename
$cmconcat :: [MkTypename] -> MkTypename
mappend :: MkTypename -> MkTypename -> MkTypename
$cmappend :: MkTypename -> MkTypename -> MkTypename
mempty :: MkTypename
$cmempty :: MkTypename
$cp1Monoid :: Semigroup MkTypename
Monoid) via (Endo Name)
withTypenameCustomization :: forall m r a. (MonadReader r m, Has MkTypename r) => MkTypename -> m a -> m a
withTypenameCustomization :: MkTypename -> m a -> m a
withTypenameCustomization = (r -> r) -> m a -> m a
forall r (m :: * -> *) a. MonadReader r m => (r -> r) -> m a -> m a
local ((r -> r) -> m a -> m a)
-> (MkTypename -> r -> r) -> MkTypename -> m a -> m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ASetter r r MkTypename MkTypename -> MkTypename -> r -> r
forall s t a b. ASetter s t a b -> b -> s -> t
set ASetter r r MkTypename MkTypename
forall a t. Has a t => Lens t a
hasLens
mkTypename :: (MonadReader r m, Has MkTypename r) => Name -> m Name
mkTypename :: Name -> m Name
mkTypename Name
name =
((Name -> Name) -> Name -> Name
forall a b. (a -> b) -> a -> b
$ Name
name) ((Name -> Name) -> Name)
-> (MkTypename -> Name -> Name) -> MkTypename -> Name
forall b c a. (b -> c) -> (a -> b) -> a -> c
. MkTypename -> Name -> Name
runMkTypename (MkTypename -> Name) -> m MkTypename -> m Name
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (r -> MkTypename) -> m MkTypename
forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks r -> MkTypename
forall a t. Has a t => t -> a
getter