{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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' {$sel:x:Point' :: Maybe Double
x = forall a. Maybe a
Prelude.Nothing, $sel:y:Point' :: Maybe Double
y = forall a. Maybe a
Prelude.Nothing}
point_x :: Lens.Lens' Point (Prelude.Maybe Prelude.Double)
point_x :: Lens' Point (Maybe Double)
point_x = 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 :: Lens' Point (Maybe Double)
point_y = 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 Data.FromJSON Point where
parseJSON :: Value -> Parser Point
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Point"
( \Object
x ->
Maybe Double -> Maybe Double -> Point
Point'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"X")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Y")
)
instance Prelude.Hashable Point where
hashWithSalt :: Int -> Point -> Int
hashWithSalt Int
_salt Point' {Maybe Double
y :: Maybe Double
x :: Maybe Double
$sel:y:Point' :: Point -> Maybe Double
$sel:x:Point' :: Point -> Maybe Double
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
x
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
y
instance Prelude.NFData Point where
rnf :: Point -> ()
rnf Point' {Maybe Double
y :: Maybe Double
x :: Maybe Double
$sel:y:Point' :: Point -> Maybe Double
$sel:x:Point' :: Point -> Maybe Double
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
x seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
y
instance Data.ToJSON Point where
toJSON :: Point -> Value
toJSON Point' {Maybe Double
y :: Maybe Double
x :: Maybe Double
$sel:y:Point' :: Point -> Maybe Double
$sel:x:Point' :: Point -> Maybe Double
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"X" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
x,
(Key
"Y" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
y
]
)