{-# 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.Pinpoint.Types.GPSCoordinates 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 GPSCoordinates = GPSCoordinates'
{
GPSCoordinates -> Double
latitude :: Prelude.Double,
GPSCoordinates -> Double
longitude :: Prelude.Double
}
deriving (GPSCoordinates -> GPSCoordinates -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GPSCoordinates -> GPSCoordinates -> Bool
$c/= :: GPSCoordinates -> GPSCoordinates -> Bool
== :: GPSCoordinates -> GPSCoordinates -> Bool
$c== :: GPSCoordinates -> GPSCoordinates -> Bool
Prelude.Eq, ReadPrec [GPSCoordinates]
ReadPrec GPSCoordinates
Int -> ReadS GPSCoordinates
ReadS [GPSCoordinates]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GPSCoordinates]
$creadListPrec :: ReadPrec [GPSCoordinates]
readPrec :: ReadPrec GPSCoordinates
$creadPrec :: ReadPrec GPSCoordinates
readList :: ReadS [GPSCoordinates]
$creadList :: ReadS [GPSCoordinates]
readsPrec :: Int -> ReadS GPSCoordinates
$creadsPrec :: Int -> ReadS GPSCoordinates
Prelude.Read, Int -> GPSCoordinates -> ShowS
[GPSCoordinates] -> ShowS
GPSCoordinates -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GPSCoordinates] -> ShowS
$cshowList :: [GPSCoordinates] -> ShowS
show :: GPSCoordinates -> String
$cshow :: GPSCoordinates -> String
showsPrec :: Int -> GPSCoordinates -> ShowS
$cshowsPrec :: Int -> GPSCoordinates -> ShowS
Prelude.Show, forall x. Rep GPSCoordinates x -> GPSCoordinates
forall x. GPSCoordinates -> Rep GPSCoordinates x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GPSCoordinates x -> GPSCoordinates
$cfrom :: forall x. GPSCoordinates -> Rep GPSCoordinates x
Prelude.Generic)
newGPSCoordinates ::
Prelude.Double ->
Prelude.Double ->
GPSCoordinates
newGPSCoordinates :: Double -> Double -> GPSCoordinates
newGPSCoordinates Double
pLatitude_ Double
pLongitude_ =
GPSCoordinates'
{ $sel:latitude:GPSCoordinates' :: Double
latitude = Double
pLatitude_,
$sel:longitude:GPSCoordinates' :: Double
longitude = Double
pLongitude_
}
gPSCoordinates_latitude :: Lens.Lens' GPSCoordinates Prelude.Double
gPSCoordinates_latitude :: Lens' GPSCoordinates Double
gPSCoordinates_latitude = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GPSCoordinates' {Double
latitude :: Double
$sel:latitude:GPSCoordinates' :: GPSCoordinates -> Double
latitude} -> Double
latitude) (\s :: GPSCoordinates
s@GPSCoordinates' {} Double
a -> GPSCoordinates
s {$sel:latitude:GPSCoordinates' :: Double
latitude = Double
a} :: GPSCoordinates)
gPSCoordinates_longitude :: Lens.Lens' GPSCoordinates Prelude.Double
gPSCoordinates_longitude :: Lens' GPSCoordinates Double
gPSCoordinates_longitude = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GPSCoordinates' {Double
longitude :: Double
$sel:longitude:GPSCoordinates' :: GPSCoordinates -> Double
longitude} -> Double
longitude) (\s :: GPSCoordinates
s@GPSCoordinates' {} Double
a -> GPSCoordinates
s {$sel:longitude:GPSCoordinates' :: Double
longitude = Double
a} :: GPSCoordinates)
instance Data.FromJSON GPSCoordinates where
parseJSON :: Value -> Parser GPSCoordinates
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"GPSCoordinates"
( \Object
x ->
Double -> Double -> GPSCoordinates
GPSCoordinates'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Latitude")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Longitude")
)
instance Prelude.Hashable GPSCoordinates where
hashWithSalt :: Int -> GPSCoordinates -> Int
hashWithSalt Int
_salt GPSCoordinates' {Double
longitude :: Double
latitude :: Double
$sel:longitude:GPSCoordinates' :: GPSCoordinates -> Double
$sel:latitude:GPSCoordinates' :: GPSCoordinates -> Double
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
latitude
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
longitude
instance Prelude.NFData GPSCoordinates where
rnf :: GPSCoordinates -> ()
rnf GPSCoordinates' {Double
longitude :: Double
latitude :: Double
$sel:longitude:GPSCoordinates' :: GPSCoordinates -> Double
$sel:latitude:GPSCoordinates' :: GPSCoordinates -> Double
..} =
forall a. NFData a => a -> ()
Prelude.rnf Double
latitude
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Double
longitude
instance Data.ToJSON GPSCoordinates where
toJSON :: GPSCoordinates -> Value
toJSON GPSCoordinates' {Double
longitude :: Double
latitude :: Double
$sel:longitude:GPSCoordinates' :: GPSCoordinates -> Double
$sel:latitude:GPSCoordinates' :: GPSCoordinates -> Double
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Latitude" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Double
latitude),
forall a. a -> Maybe a
Prelude.Just (Key
"Longitude" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Double
longitude)
]
)