{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.Rekognition.Types.Point where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Point = Point'
{
Point -> Maybe Double
x :: Prelude.Maybe Prelude.Double,
Point -> Maybe Double
y :: Prelude.Maybe Prelude.Double
}
deriving (Point -> Point -> Bool
(Point -> Point -> Bool) -> (Point -> Point -> Bool) -> Eq Point
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Point -> Point -> Bool
$c/= :: Point -> Point -> Bool
== :: Point -> Point -> Bool
$c== :: Point -> Point -> Bool
Prelude.Eq, ReadPrec [Point]
ReadPrec Point
Int -> ReadS Point
ReadS [Point]
(Int -> ReadS Point)
-> ReadS [Point]
-> ReadPrec Point
-> ReadPrec [Point]
-> Read Point
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Point]
$creadListPrec :: ReadPrec [Point]
readPrec :: ReadPrec Point
$creadPrec :: ReadPrec Point
readList :: ReadS [Point]
$creadList :: ReadS [Point]
readsPrec :: Int -> ReadS Point
$creadsPrec :: Int -> ReadS Point
Prelude.Read, Int -> Point -> ShowS
[Point] -> ShowS
Point -> String
(Int -> Point -> ShowS)
-> (Point -> String) -> ([Point] -> ShowS) -> Show Point
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Point] -> ShowS
$cshowList :: [Point] -> ShowS
show :: Point -> String
$cshow :: Point -> String
showsPrec :: Int -> Point -> ShowS
$cshowsPrec :: Int -> Point -> ShowS
Prelude.Show, (forall x. Point -> Rep Point x)
-> (forall x. Rep Point x -> Point) -> Generic Point
forall x. Rep Point x -> Point
forall x. Point -> Rep Point x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Point x -> Point
$cfrom :: forall x. Point -> Rep Point x
Prelude.Generic)
newPoint ::
Point
newPoint :: Point
newPoint =
Point' :: Maybe Double -> Maybe Double -> Point
Point' {$sel:x:Point' :: Maybe Double
x = Maybe Double
forall a. Maybe a
Prelude.Nothing, $sel:y:Point' :: Maybe Double
y = Maybe Double
forall a. Maybe a
Prelude.Nothing}
point_x :: Lens.Lens' Point (Prelude.Maybe Prelude.Double)
point_x :: (Maybe Double -> f (Maybe Double)) -> Point -> f Point
point_x = (Point -> Maybe Double)
-> (Point -> Maybe Double -> Point)
-> Lens Point Point (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Point' {Maybe Double
x :: Maybe Double
$sel:x:Point' :: Point -> Maybe Double
x} -> Maybe Double
x) (\s :: Point
s@Point' {} Maybe Double
a -> Point
s {$sel:x:Point' :: Maybe Double
x = Maybe Double
a} :: Point)
point_y :: Lens.Lens' Point (Prelude.Maybe Prelude.Double)
point_y :: (Maybe Double -> f (Maybe Double)) -> Point -> f Point
point_y = (Point -> Maybe Double)
-> (Point -> Maybe Double -> Point)
-> Lens Point Point (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Point' {Maybe Double
y :: Maybe Double
$sel:y:Point' :: Point -> Maybe Double
y} -> Maybe Double
y) (\s :: Point
s@Point' {} Maybe Double
a -> Point
s {$sel:y:Point' :: Maybe Double
y = Maybe Double
a} :: Point)
instance Core.FromJSON Point where
parseJSON :: Value -> Parser Point
parseJSON =
String -> (Object -> Parser Point) -> Value -> Parser Point
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Point"
( \Object
x ->
Maybe Double -> Maybe Double -> Point
Point'
(Maybe Double -> Maybe Double -> Point)
-> Parser (Maybe Double) -> Parser (Maybe Double -> Point)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"X") Parser (Maybe Double -> Point)
-> Parser (Maybe Double) -> Parser Point
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Y")
)
instance Prelude.Hashable Point
instance Prelude.NFData Point