module Patrol.Type.Response where import qualified Data.Aeson as Aeson import qualified Data.Aeson.Key as Key import qualified Data.Typeable as Typeable import qualified Patrol.Type.EventId as EventId newtype Response = Response { Response -> EventId id :: EventId.EventId } deriving (Response -> Response -> Bool (Response -> Response -> Bool) -> (Response -> Response -> Bool) -> Eq Response forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a $c== :: Response -> Response -> Bool == :: Response -> Response -> Bool $c/= :: Response -> Response -> Bool /= :: Response -> Response -> Bool Eq, Int -> Response -> ShowS [Response] -> ShowS Response -> String (Int -> Response -> ShowS) -> (Response -> String) -> ([Response] -> ShowS) -> Show Response forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a $cshowsPrec :: Int -> Response -> ShowS showsPrec :: Int -> Response -> ShowS $cshow :: Response -> String show :: Response -> String $cshowList :: [Response] -> ShowS showList :: [Response] -> ShowS Show) instance Aeson.FromJSON Response where parseJSON :: Value -> Parser Response parseJSON = let name :: String name = TypeRep -> String forall a. Show a => a -> String show (TypeRep -> String) -> TypeRep -> String forall a b. (a -> b) -> a -> b $ Proxy Response -> TypeRep forall {k} (proxy :: k -> *) (a :: k). Typeable a => proxy a -> TypeRep Typeable.typeRep (Proxy Response forall {k} (t :: k). Proxy t Typeable.Proxy :: Typeable.Proxy Response) in String -> (Object -> Parser Response) -> Value -> Parser Response forall a. String -> (Object -> Parser a) -> Value -> Parser a Aeson.withObject String name ((Object -> Parser Response) -> Value -> Parser Response) -> (Object -> Parser Response) -> Value -> Parser Response forall a b. (a -> b) -> a -> b $ \Object object -> do EventId theId <- Object object Object -> Key -> Parser EventId forall a. FromJSON a => Object -> Key -> Parser a Aeson..: String -> Key Key.fromString String "id" Response -> Parser Response forall a. a -> Parser a forall (f :: * -> *) a. Applicative f => a -> f a pure Response { id :: EventId Patrol.Type.Response.id = EventId theId }