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