{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data Trait = Trait'
{
Trait -> Maybe AttributeName
name :: Prelude.Maybe AttributeName,
Trait -> Maybe Double
score :: Prelude.Maybe Prelude.Double
}
deriving (Trait -> Trait -> Bool
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]
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
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. 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'
{ $sel:name:Trait' :: Maybe AttributeName
name = forall a. Maybe a
Prelude.Nothing,
$sel:score:Trait' :: Maybe Double
score = forall a. Maybe a
Prelude.Nothing
}
trait_name :: Lens.Lens' Trait (Prelude.Maybe AttributeName)
trait_name :: Lens' Trait (Maybe AttributeName)
trait_name = 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)
trait_score :: Lens.Lens' Trait (Prelude.Maybe Prelude.Double)
trait_score :: Lens' Trait (Maybe Double)
trait_score = 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)
instance Data.FromJSON Trait where
parseJSON :: Value -> Parser Trait
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Trait"
( \Object
x ->
Maybe AttributeName -> Maybe Double -> Trait
Trait'
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
"Name")
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
"Score")
)
instance Prelude.Hashable Trait where
hashWithSalt :: Int -> Trait -> Int
hashWithSalt Int
_salt Trait' {Maybe Double
Maybe AttributeName
score :: Maybe Double
name :: Maybe AttributeName
$sel:score:Trait' :: Trait -> Maybe Double
$sel:name:Trait' :: Trait -> Maybe AttributeName
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AttributeName
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
score
instance Prelude.NFData Trait where
rnf :: Trait -> ()
rnf Trait' {Maybe Double
Maybe AttributeName
score :: Maybe Double
name :: Maybe AttributeName
$sel:score:Trait' :: Trait -> Maybe Double
$sel:name:Trait' :: Trait -> Maybe AttributeName
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe AttributeName
name seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
score