{-# LANGUAGE CPP #-}
module GitHub.Data.Name (
Name(..),
mkName,
untagName,
) where
import Prelude ()
import GitHub.Internal.Prelude
#if MIN_VERSION_aeson(1,0,0)
import Data.Aeson.Types
(FromJSONKey (..), ToJSONKey (..), fromJSONKeyCoerce, toJSONKeyText)
#endif
newtype Name entity = N Text
deriving (Name entity -> Name entity -> Bool
(Name entity -> Name entity -> Bool)
-> (Name entity -> Name entity -> Bool) -> Eq (Name entity)
forall entity. Name entity -> Name entity -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Name entity -> Name entity -> Bool
$c/= :: forall entity. Name entity -> Name entity -> Bool
== :: Name entity -> Name entity -> Bool
$c== :: forall entity. Name entity -> Name entity -> Bool
Eq, Eq (Name entity)
Eq (Name entity)
-> (Name entity -> Name entity -> Ordering)
-> (Name entity -> Name entity -> Bool)
-> (Name entity -> Name entity -> Bool)
-> (Name entity -> Name entity -> Bool)
-> (Name entity -> Name entity -> Bool)
-> (Name entity -> Name entity -> Name entity)
-> (Name entity -> Name entity -> Name entity)
-> Ord (Name entity)
Name entity -> Name entity -> Bool
Name entity -> Name entity -> Ordering
Name entity -> Name entity -> Name entity
forall entity. Eq (Name entity)
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall entity. Name entity -> Name entity -> Bool
forall entity. Name entity -> Name entity -> Ordering
forall entity. Name entity -> Name entity -> Name entity
min :: Name entity -> Name entity -> Name entity
$cmin :: forall entity. Name entity -> Name entity -> Name entity
max :: Name entity -> Name entity -> Name entity
$cmax :: forall entity. Name entity -> Name entity -> Name entity
>= :: Name entity -> Name entity -> Bool
$c>= :: forall entity. Name entity -> Name entity -> Bool
> :: Name entity -> Name entity -> Bool
$c> :: forall entity. Name entity -> Name entity -> Bool
<= :: Name entity -> Name entity -> Bool
$c<= :: forall entity. Name entity -> Name entity -> Bool
< :: Name entity -> Name entity -> Bool
$c< :: forall entity. Name entity -> Name entity -> Bool
compare :: Name entity -> Name entity -> Ordering
$ccompare :: forall entity. Name entity -> Name entity -> Ordering
$cp1Ord :: forall entity. Eq (Name entity)
Ord, Int -> Name entity -> ShowS
[Name entity] -> ShowS
Name entity -> String
(Int -> Name entity -> ShowS)
-> (Name entity -> String)
-> ([Name entity] -> ShowS)
-> Show (Name entity)
forall entity. Int -> Name entity -> ShowS
forall entity. [Name entity] -> ShowS
forall entity. Name entity -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Name entity] -> ShowS
$cshowList :: forall entity. [Name entity] -> ShowS
show :: Name entity -> String
$cshow :: forall entity. Name entity -> String
showsPrec :: Int -> Name entity -> ShowS
$cshowsPrec :: forall entity. Int -> Name entity -> ShowS
Show, (forall x. Name entity -> Rep (Name entity) x)
-> (forall x. Rep (Name entity) x -> Name entity)
-> Generic (Name entity)
forall x. Rep (Name entity) x -> Name entity
forall x. Name entity -> Rep (Name entity) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall entity x. Rep (Name entity) x -> Name entity
forall entity x. Name entity -> Rep (Name entity) x
$cto :: forall entity x. Rep (Name entity) x -> Name entity
$cfrom :: forall entity x. Name entity -> Rep (Name entity) x
Generic, Typeable, Typeable (Name entity)
DataType
Constr
Typeable (Name entity)
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Name entity -> c (Name entity))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Name entity))
-> (Name entity -> Constr)
-> (Name entity -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Name entity)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Name entity)))
-> ((forall b. Data b => b -> b) -> Name entity -> Name entity)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Name entity -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Name entity -> r)
-> (forall u. (forall d. Data d => d -> u) -> Name entity -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> Name entity -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Name entity -> m (Name entity))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Name entity -> m (Name entity))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Name entity -> m (Name entity))
-> Data (Name entity)
Name entity -> DataType
Name entity -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (Name entity))
(forall b. Data b => b -> b) -> Name entity -> Name entity
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Name entity -> c (Name entity)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Name entity)
forall entity. Data entity => Typeable (Name entity)
forall entity. Data entity => Name entity -> DataType
forall entity. Data entity => Name entity -> Constr
forall entity.
Data entity =>
(forall b. Data b => b -> b) -> Name entity -> Name entity
forall entity u.
Data entity =>
Int -> (forall d. Data d => d -> u) -> Name entity -> u
forall entity u.
Data entity =>
(forall d. Data d => d -> u) -> Name entity -> [u]
forall entity r r'.
Data entity =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Name entity -> r
forall entity r r'.
Data entity =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Name entity -> r
forall entity (m :: * -> *).
(Data entity, Monad m) =>
(forall d. Data d => d -> m d) -> Name entity -> m (Name entity)
forall entity (m :: * -> *).
(Data entity, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Name entity -> m (Name entity)
forall entity (c :: * -> *).
Data entity =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Name entity)
forall entity (c :: * -> *).
Data entity =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Name entity -> c (Name entity)
forall entity (t :: * -> *) (c :: * -> *).
(Data entity, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Name entity))
forall entity (t :: * -> * -> *) (c :: * -> *).
(Data entity, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Name entity))
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Name entity -> u
forall u. (forall d. Data d => d -> u) -> Name entity -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Name entity -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Name entity -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Name entity -> m (Name entity)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Name entity -> m (Name entity)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Name entity)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Name entity -> c (Name entity)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Name entity))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Name entity))
$cN :: Constr
$tName :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Name entity -> m (Name entity)
$cgmapMo :: forall entity (m :: * -> *).
(Data entity, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Name entity -> m (Name entity)
gmapMp :: (forall d. Data d => d -> m d) -> Name entity -> m (Name entity)
$cgmapMp :: forall entity (m :: * -> *).
(Data entity, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Name entity -> m (Name entity)
gmapM :: (forall d. Data d => d -> m d) -> Name entity -> m (Name entity)
$cgmapM :: forall entity (m :: * -> *).
(Data entity, Monad m) =>
(forall d. Data d => d -> m d) -> Name entity -> m (Name entity)
gmapQi :: Int -> (forall d. Data d => d -> u) -> Name entity -> u
$cgmapQi :: forall entity u.
Data entity =>
Int -> (forall d. Data d => d -> u) -> Name entity -> u
gmapQ :: (forall d. Data d => d -> u) -> Name entity -> [u]
$cgmapQ :: forall entity u.
Data entity =>
(forall d. Data d => d -> u) -> Name entity -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Name entity -> r
$cgmapQr :: forall entity r r'.
Data entity =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Name entity -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Name entity -> r
$cgmapQl :: forall entity r r'.
Data entity =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Name entity -> r
gmapT :: (forall b. Data b => b -> b) -> Name entity -> Name entity
$cgmapT :: forall entity.
Data entity =>
(forall b. Data b => b -> b) -> Name entity -> Name entity
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Name entity))
$cdataCast2 :: forall entity (t :: * -> * -> *) (c :: * -> *).
(Data entity, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Name entity))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (Name entity))
$cdataCast1 :: forall entity (t :: * -> *) (c :: * -> *).
(Data entity, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Name entity))
dataTypeOf :: Name entity -> DataType
$cdataTypeOf :: forall entity. Data entity => Name entity -> DataType
toConstr :: Name entity -> Constr
$ctoConstr :: forall entity. Data entity => Name entity -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Name entity)
$cgunfold :: forall entity (c :: * -> *).
Data entity =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Name entity)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Name entity -> c (Name entity)
$cgfoldl :: forall entity (c :: * -> *).
Data entity =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Name entity -> c (Name entity)
$cp1Data :: forall entity. Data entity => Typeable (Name entity)
Data)
mkName :: proxy entity -> Text -> Name entity
mkName :: proxy entity -> Text -> Name entity
mkName proxy entity
_ = Text -> Name entity
forall entity. Text -> Name entity
N
untagName :: Name entity -> Text
untagName :: Name entity -> Text
untagName (N Text
name) = Text
name
instance Hashable (Name entity)
instance Binary (Name entity)
instance NFData (Name entity) where
rnf :: Name entity -> ()
rnf (N Text
s) = Text -> ()
forall a. NFData a => a -> ()
rnf Text
s
instance FromJSON (Name entity) where
parseJSON :: Value -> Parser (Name entity)
parseJSON = (Text -> Name entity) -> Parser Text -> Parser (Name entity)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> Name entity
forall entity. Text -> Name entity
N (Parser Text -> Parser (Name entity))
-> (Value -> Parser Text) -> Value -> Parser (Name entity)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
parseJSON
instance ToJSON (Name entity) where
toJSON :: Name entity -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
toJSON (Text -> Value) -> (Name entity -> Text) -> Name entity -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Name entity -> Text
forall entity. Name entity -> Text
untagName
instance IsString (Name entity) where
fromString :: String -> Name entity
fromString = Text -> Name entity
forall entity. Text -> Name entity
N (Text -> Name entity) -> (String -> Text) -> String -> Name entity
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
forall a. IsString a => String -> a
fromString
#if MIN_VERSION_aeson(1,0,0)
instance ToJSONKey (Name entity) where
toJSONKey :: ToJSONKeyFunction (Name entity)
toJSONKey = (Name entity -> Text) -> ToJSONKeyFunction (Name entity)
forall a. (a -> Text) -> ToJSONKeyFunction a
toJSONKeyText Name entity -> Text
forall entity. Name entity -> Text
untagName
instance FromJSONKey (Name entity) where
fromJSONKey :: FromJSONKeyFunction (Name entity)
fromJSONKey = FromJSONKeyFunction (Name entity)
forall a. Coercible Text a => FromJSONKeyFunction a
fromJSONKeyCoerce
#endif