module GitHub.Data.Id (
Id(..),
mkId,
untagId,
) where
import GitHub.Internal.Prelude
import Prelude ()
newtype Id entity = Id Int
deriving (Id entity -> Id entity -> Bool
(Id entity -> Id entity -> Bool)
-> (Id entity -> Id entity -> Bool) -> Eq (Id entity)
forall entity. Id entity -> Id entity -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Id entity -> Id entity -> Bool
$c/= :: forall entity. Id entity -> Id entity -> Bool
== :: Id entity -> Id entity -> Bool
$c== :: forall entity. Id entity -> Id entity -> Bool
Eq, Eq (Id entity)
Eq (Id entity)
-> (Id entity -> Id entity -> Ordering)
-> (Id entity -> Id entity -> Bool)
-> (Id entity -> Id entity -> Bool)
-> (Id entity -> Id entity -> Bool)
-> (Id entity -> Id entity -> Bool)
-> (Id entity -> Id entity -> Id entity)
-> (Id entity -> Id entity -> Id entity)
-> Ord (Id entity)
Id entity -> Id entity -> Bool
Id entity -> Id entity -> Ordering
Id entity -> Id entity -> Id entity
forall entity. Eq (Id 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. Id entity -> Id entity -> Bool
forall entity. Id entity -> Id entity -> Ordering
forall entity. Id entity -> Id entity -> Id entity
min :: Id entity -> Id entity -> Id entity
$cmin :: forall entity. Id entity -> Id entity -> Id entity
max :: Id entity -> Id entity -> Id entity
$cmax :: forall entity. Id entity -> Id entity -> Id entity
>= :: Id entity -> Id entity -> Bool
$c>= :: forall entity. Id entity -> Id entity -> Bool
> :: Id entity -> Id entity -> Bool
$c> :: forall entity. Id entity -> Id entity -> Bool
<= :: Id entity -> Id entity -> Bool
$c<= :: forall entity. Id entity -> Id entity -> Bool
< :: Id entity -> Id entity -> Bool
$c< :: forall entity. Id entity -> Id entity -> Bool
compare :: Id entity -> Id entity -> Ordering
$ccompare :: forall entity. Id entity -> Id entity -> Ordering
$cp1Ord :: forall entity. Eq (Id entity)
Ord, Int -> Id entity -> ShowS
[Id entity] -> ShowS
Id entity -> String
(Int -> Id entity -> ShowS)
-> (Id entity -> String)
-> ([Id entity] -> ShowS)
-> Show (Id entity)
forall entity. Int -> Id entity -> ShowS
forall entity. [Id entity] -> ShowS
forall entity. Id entity -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Id entity] -> ShowS
$cshowList :: forall entity. [Id entity] -> ShowS
show :: Id entity -> String
$cshow :: forall entity. Id entity -> String
showsPrec :: Int -> Id entity -> ShowS
$cshowsPrec :: forall entity. Int -> Id entity -> ShowS
Show, (forall x. Id entity -> Rep (Id entity) x)
-> (forall x. Rep (Id entity) x -> Id entity)
-> Generic (Id entity)
forall x. Rep (Id entity) x -> Id entity
forall x. Id entity -> Rep (Id entity) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall entity x. Rep (Id entity) x -> Id entity
forall entity x. Id entity -> Rep (Id entity) x
$cto :: forall entity x. Rep (Id entity) x -> Id entity
$cfrom :: forall entity x. Id entity -> Rep (Id entity) x
Generic, Typeable, Typeable (Id entity)
DataType
Constr
Typeable (Id entity)
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Id entity -> c (Id entity))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Id entity))
-> (Id entity -> Constr)
-> (Id entity -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Id entity)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Id entity)))
-> ((forall b. Data b => b -> b) -> Id entity -> Id entity)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Id entity -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Id entity -> r)
-> (forall u. (forall d. Data d => d -> u) -> Id entity -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> Id entity -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Id entity -> m (Id entity))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Id entity -> m (Id entity))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Id entity -> m (Id entity))
-> Data (Id entity)
Id entity -> DataType
Id entity -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (Id entity))
(forall b. Data b => b -> b) -> Id entity -> Id entity
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Id entity -> c (Id entity)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Id entity)
forall entity. Data entity => Typeable (Id entity)
forall entity. Data entity => Id entity -> DataType
forall entity. Data entity => Id entity -> Constr
forall entity.
Data entity =>
(forall b. Data b => b -> b) -> Id entity -> Id entity
forall entity u.
Data entity =>
Int -> (forall d. Data d => d -> u) -> Id entity -> u
forall entity u.
Data entity =>
(forall d. Data d => d -> u) -> Id entity -> [u]
forall entity r r'.
Data entity =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Id entity -> r
forall entity r r'.
Data entity =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Id entity -> r
forall entity (m :: * -> *).
(Data entity, Monad m) =>
(forall d. Data d => d -> m d) -> Id entity -> m (Id entity)
forall entity (m :: * -> *).
(Data entity, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Id entity -> m (Id entity)
forall entity (c :: * -> *).
Data entity =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Id entity)
forall entity (c :: * -> *).
Data entity =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Id entity -> c (Id entity)
forall entity (t :: * -> *) (c :: * -> *).
(Data entity, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Id entity))
forall entity (t :: * -> * -> *) (c :: * -> *).
(Data entity, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Id 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) -> Id entity -> u
forall u. (forall d. Data d => d -> u) -> Id entity -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Id entity -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Id entity -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Id entity -> m (Id entity)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Id entity -> m (Id entity)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Id entity)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Id entity -> c (Id entity)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Id entity))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Id entity))
$cId :: Constr
$tId :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Id entity -> m (Id entity)
$cgmapMo :: forall entity (m :: * -> *).
(Data entity, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Id entity -> m (Id entity)
gmapMp :: (forall d. Data d => d -> m d) -> Id entity -> m (Id entity)
$cgmapMp :: forall entity (m :: * -> *).
(Data entity, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Id entity -> m (Id entity)
gmapM :: (forall d. Data d => d -> m d) -> Id entity -> m (Id entity)
$cgmapM :: forall entity (m :: * -> *).
(Data entity, Monad m) =>
(forall d. Data d => d -> m d) -> Id entity -> m (Id entity)
gmapQi :: Int -> (forall d. Data d => d -> u) -> Id entity -> u
$cgmapQi :: forall entity u.
Data entity =>
Int -> (forall d. Data d => d -> u) -> Id entity -> u
gmapQ :: (forall d. Data d => d -> u) -> Id entity -> [u]
$cgmapQ :: forall entity u.
Data entity =>
(forall d. Data d => d -> u) -> Id entity -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Id entity -> r
$cgmapQr :: forall entity r r'.
Data entity =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Id entity -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Id entity -> r
$cgmapQl :: forall entity r r'.
Data entity =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Id entity -> r
gmapT :: (forall b. Data b => b -> b) -> Id entity -> Id entity
$cgmapT :: forall entity.
Data entity =>
(forall b. Data b => b -> b) -> Id entity -> Id entity
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Id entity))
$cdataCast2 :: forall entity (t :: * -> * -> *) (c :: * -> *).
(Data entity, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Id entity))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (Id entity))
$cdataCast1 :: forall entity (t :: * -> *) (c :: * -> *).
(Data entity, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Id entity))
dataTypeOf :: Id entity -> DataType
$cdataTypeOf :: forall entity. Data entity => Id entity -> DataType
toConstr :: Id entity -> Constr
$ctoConstr :: forall entity. Data entity => Id entity -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Id entity)
$cgunfold :: forall entity (c :: * -> *).
Data entity =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Id entity)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Id entity -> c (Id entity)
$cgfoldl :: forall entity (c :: * -> *).
Data entity =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Id entity -> c (Id entity)
$cp1Data :: forall entity. Data entity => Typeable (Id entity)
Data)
mkId :: proxy entity -> Int -> Id entity
mkId :: proxy entity -> Int -> Id entity
mkId proxy entity
_ = Int -> Id entity
forall entity. Int -> Id entity
Id
untagId :: Id entity -> Int
untagId :: Id entity -> Int
untagId (Id Int
name) = Int
name
instance Hashable (Id entity)
instance Binary (Id entity)
instance NFData (Id entity) where
rnf :: Id entity -> ()
rnf (Id Int
s) = Int -> ()
forall a. NFData a => a -> ()
rnf Int
s
instance FromJSON (Id entity) where
parseJSON :: Value -> Parser (Id entity)
parseJSON = (Int -> Id entity) -> Parser Int -> Parser (Id entity)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Int -> Id entity
forall entity. Int -> Id entity
Id (Parser Int -> Parser (Id entity))
-> (Value -> Parser Int) -> Value -> Parser (Id entity)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Value -> Parser Int
forall a. FromJSON a => Value -> Parser a
parseJSON
instance ToJSON (Id entity) where
toJSON :: Id entity -> Value
toJSON = Int -> Value
forall a. ToJSON a => a -> Value
toJSON (Int -> Value) -> (Id entity -> Int) -> Id entity -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Id entity -> Int
forall entity. Id entity -> Int
untagId