{-# 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.Comprehend.Types.DominantLanguage where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data DominantLanguage = DominantLanguage'
{
DominantLanguage -> Maybe Text
languageCode :: Prelude.Maybe Prelude.Text,
DominantLanguage -> Maybe Double
score :: Prelude.Maybe Prelude.Double
}
deriving (DominantLanguage -> DominantLanguage -> Bool
(DominantLanguage -> DominantLanguage -> Bool)
-> (DominantLanguage -> DominantLanguage -> Bool)
-> Eq DominantLanguage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DominantLanguage -> DominantLanguage -> Bool
$c/= :: DominantLanguage -> DominantLanguage -> Bool
== :: DominantLanguage -> DominantLanguage -> Bool
$c== :: DominantLanguage -> DominantLanguage -> Bool
Prelude.Eq, ReadPrec [DominantLanguage]
ReadPrec DominantLanguage
Int -> ReadS DominantLanguage
ReadS [DominantLanguage]
(Int -> ReadS DominantLanguage)
-> ReadS [DominantLanguage]
-> ReadPrec DominantLanguage
-> ReadPrec [DominantLanguage]
-> Read DominantLanguage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DominantLanguage]
$creadListPrec :: ReadPrec [DominantLanguage]
readPrec :: ReadPrec DominantLanguage
$creadPrec :: ReadPrec DominantLanguage
readList :: ReadS [DominantLanguage]
$creadList :: ReadS [DominantLanguage]
readsPrec :: Int -> ReadS DominantLanguage
$creadsPrec :: Int -> ReadS DominantLanguage
Prelude.Read, Int -> DominantLanguage -> ShowS
[DominantLanguage] -> ShowS
DominantLanguage -> String
(Int -> DominantLanguage -> ShowS)
-> (DominantLanguage -> String)
-> ([DominantLanguage] -> ShowS)
-> Show DominantLanguage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DominantLanguage] -> ShowS
$cshowList :: [DominantLanguage] -> ShowS
show :: DominantLanguage -> String
$cshow :: DominantLanguage -> String
showsPrec :: Int -> DominantLanguage -> ShowS
$cshowsPrec :: Int -> DominantLanguage -> ShowS
Prelude.Show, (forall x. DominantLanguage -> Rep DominantLanguage x)
-> (forall x. Rep DominantLanguage x -> DominantLanguage)
-> Generic DominantLanguage
forall x. Rep DominantLanguage x -> DominantLanguage
forall x. DominantLanguage -> Rep DominantLanguage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DominantLanguage x -> DominantLanguage
$cfrom :: forall x. DominantLanguage -> Rep DominantLanguage x
Prelude.Generic)
newDominantLanguage ::
DominantLanguage
newDominantLanguage :: DominantLanguage
newDominantLanguage =
DominantLanguage' :: Maybe Text -> Maybe Double -> DominantLanguage
DominantLanguage'
{ $sel:languageCode:DominantLanguage' :: Maybe Text
languageCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:score:DominantLanguage' :: Maybe Double
score = Maybe Double
forall a. Maybe a
Prelude.Nothing
}
dominantLanguage_languageCode :: Lens.Lens' DominantLanguage (Prelude.Maybe Prelude.Text)
dominantLanguage_languageCode :: (Maybe Text -> f (Maybe Text))
-> DominantLanguage -> f DominantLanguage
dominantLanguage_languageCode = (DominantLanguage -> Maybe Text)
-> (DominantLanguage -> Maybe Text -> DominantLanguage)
-> Lens DominantLanguage DominantLanguage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DominantLanguage' {Maybe Text
languageCode :: Maybe Text
$sel:languageCode:DominantLanguage' :: DominantLanguage -> Maybe Text
languageCode} -> Maybe Text
languageCode) (\s :: DominantLanguage
s@DominantLanguage' {} Maybe Text
a -> DominantLanguage
s {$sel:languageCode:DominantLanguage' :: Maybe Text
languageCode = Maybe Text
a} :: DominantLanguage)
dominantLanguage_score :: Lens.Lens' DominantLanguage (Prelude.Maybe Prelude.Double)
dominantLanguage_score :: (Maybe Double -> f (Maybe Double))
-> DominantLanguage -> f DominantLanguage
dominantLanguage_score = (DominantLanguage -> Maybe Double)
-> (DominantLanguage -> Maybe Double -> DominantLanguage)
-> Lens
DominantLanguage DominantLanguage (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DominantLanguage' {Maybe Double
score :: Maybe Double
$sel:score:DominantLanguage' :: DominantLanguage -> Maybe Double
score} -> Maybe Double
score) (\s :: DominantLanguage
s@DominantLanguage' {} Maybe Double
a -> DominantLanguage
s {$sel:score:DominantLanguage' :: Maybe Double
score = Maybe Double
a} :: DominantLanguage)
instance Core.FromJSON DominantLanguage where
parseJSON :: Value -> Parser DominantLanguage
parseJSON =
String
-> (Object -> Parser DominantLanguage)
-> Value
-> Parser DominantLanguage
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"DominantLanguage"
( \Object
x ->
Maybe Text -> Maybe Double -> DominantLanguage
DominantLanguage'
(Maybe Text -> Maybe Double -> DominantLanguage)
-> Parser (Maybe Text) -> Parser (Maybe Double -> DominantLanguage)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LanguageCode")
Parser (Maybe Double -> DominantLanguage)
-> Parser (Maybe Double) -> Parser DominantLanguage
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
"Score")
)
instance Prelude.Hashable DominantLanguage
instance Prelude.NFData DominantLanguage