{-# 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.MentionSentiment where
import Amazonka.Comprehend.Types.SentimentScore
import Amazonka.Comprehend.Types.SentimentType
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 MentionSentiment = MentionSentiment'
{
MentionSentiment -> Maybe SentimentType
sentiment :: Prelude.Maybe SentimentType,
MentionSentiment -> Maybe SentimentScore
sentimentScore :: Prelude.Maybe SentimentScore
}
deriving (MentionSentiment -> MentionSentiment -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MentionSentiment -> MentionSentiment -> Bool
$c/= :: MentionSentiment -> MentionSentiment -> Bool
== :: MentionSentiment -> MentionSentiment -> Bool
$c== :: MentionSentiment -> MentionSentiment -> Bool
Prelude.Eq, ReadPrec [MentionSentiment]
ReadPrec MentionSentiment
Int -> ReadS MentionSentiment
ReadS [MentionSentiment]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MentionSentiment]
$creadListPrec :: ReadPrec [MentionSentiment]
readPrec :: ReadPrec MentionSentiment
$creadPrec :: ReadPrec MentionSentiment
readList :: ReadS [MentionSentiment]
$creadList :: ReadS [MentionSentiment]
readsPrec :: Int -> ReadS MentionSentiment
$creadsPrec :: Int -> ReadS MentionSentiment
Prelude.Read, Int -> MentionSentiment -> ShowS
[MentionSentiment] -> ShowS
MentionSentiment -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MentionSentiment] -> ShowS
$cshowList :: [MentionSentiment] -> ShowS
show :: MentionSentiment -> String
$cshow :: MentionSentiment -> String
showsPrec :: Int -> MentionSentiment -> ShowS
$cshowsPrec :: Int -> MentionSentiment -> ShowS
Prelude.Show, forall x. Rep MentionSentiment x -> MentionSentiment
forall x. MentionSentiment -> Rep MentionSentiment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MentionSentiment x -> MentionSentiment
$cfrom :: forall x. MentionSentiment -> Rep MentionSentiment x
Prelude.Generic)
newMentionSentiment ::
MentionSentiment
newMentionSentiment :: MentionSentiment
newMentionSentiment =
MentionSentiment'
{ $sel:sentiment:MentionSentiment' :: Maybe SentimentType
sentiment = forall a. Maybe a
Prelude.Nothing,
$sel:sentimentScore:MentionSentiment' :: Maybe SentimentScore
sentimentScore = forall a. Maybe a
Prelude.Nothing
}
mentionSentiment_sentiment :: Lens.Lens' MentionSentiment (Prelude.Maybe SentimentType)
mentionSentiment_sentiment :: Lens' MentionSentiment (Maybe SentimentType)
mentionSentiment_sentiment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MentionSentiment' {Maybe SentimentType
sentiment :: Maybe SentimentType
$sel:sentiment:MentionSentiment' :: MentionSentiment -> Maybe SentimentType
sentiment} -> Maybe SentimentType
sentiment) (\s :: MentionSentiment
s@MentionSentiment' {} Maybe SentimentType
a -> MentionSentiment
s {$sel:sentiment:MentionSentiment' :: Maybe SentimentType
sentiment = Maybe SentimentType
a} :: MentionSentiment)
mentionSentiment_sentimentScore :: Lens.Lens' MentionSentiment (Prelude.Maybe SentimentScore)
mentionSentiment_sentimentScore :: Lens' MentionSentiment (Maybe SentimentScore)
mentionSentiment_sentimentScore = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MentionSentiment' {Maybe SentimentScore
sentimentScore :: Maybe SentimentScore
$sel:sentimentScore:MentionSentiment' :: MentionSentiment -> Maybe SentimentScore
sentimentScore} -> Maybe SentimentScore
sentimentScore) (\s :: MentionSentiment
s@MentionSentiment' {} Maybe SentimentScore
a -> MentionSentiment
s {$sel:sentimentScore:MentionSentiment' :: Maybe SentimentScore
sentimentScore = Maybe SentimentScore
a} :: MentionSentiment)
instance Data.FromJSON MentionSentiment where
parseJSON :: Value -> Parser MentionSentiment
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"MentionSentiment"
( \Object
x ->
Maybe SentimentType -> Maybe SentimentScore -> MentionSentiment
MentionSentiment'
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
"Sentiment")
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
"SentimentScore")
)
instance Prelude.Hashable MentionSentiment where
hashWithSalt :: Int -> MentionSentiment -> Int
hashWithSalt Int
_salt MentionSentiment' {Maybe SentimentScore
Maybe SentimentType
sentimentScore :: Maybe SentimentScore
sentiment :: Maybe SentimentType
$sel:sentimentScore:MentionSentiment' :: MentionSentiment -> Maybe SentimentScore
$sel:sentiment:MentionSentiment' :: MentionSentiment -> Maybe SentimentType
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SentimentType
sentiment
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SentimentScore
sentimentScore
instance Prelude.NFData MentionSentiment where
rnf :: MentionSentiment -> ()
rnf MentionSentiment' {Maybe SentimentScore
Maybe SentimentType
sentimentScore :: Maybe SentimentScore
sentiment :: Maybe SentimentType
$sel:sentimentScore:MentionSentiment' :: MentionSentiment -> Maybe SentimentScore
$sel:sentiment:MentionSentiment' :: MentionSentiment -> Maybe SentimentType
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe SentimentType
sentiment
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SentimentScore
sentimentScore