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