{-# 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.AccessAnalyzer.Types.Span where
import Amazonka.AccessAnalyzer.Types.Position
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Span = Span'
{
Span -> Position
end :: Position,
Span -> Position
start :: Position
}
deriving (Span -> Span -> Bool
(Span -> Span -> Bool) -> (Span -> Span -> Bool) -> Eq Span
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Span -> Span -> Bool
$c/= :: Span -> Span -> Bool
== :: Span -> Span -> Bool
$c== :: Span -> Span -> Bool
Prelude.Eq, ReadPrec [Span]
ReadPrec Span
Int -> ReadS Span
ReadS [Span]
(Int -> ReadS Span)
-> ReadS [Span] -> ReadPrec Span -> ReadPrec [Span] -> Read Span
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Span]
$creadListPrec :: ReadPrec [Span]
readPrec :: ReadPrec Span
$creadPrec :: ReadPrec Span
readList :: ReadS [Span]
$creadList :: ReadS [Span]
readsPrec :: Int -> ReadS Span
$creadsPrec :: Int -> ReadS Span
Prelude.Read, Int -> Span -> ShowS
[Span] -> ShowS
Span -> String
(Int -> Span -> ShowS)
-> (Span -> String) -> ([Span] -> ShowS) -> Show Span
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Span] -> ShowS
$cshowList :: [Span] -> ShowS
show :: Span -> String
$cshow :: Span -> String
showsPrec :: Int -> Span -> ShowS
$cshowsPrec :: Int -> Span -> ShowS
Prelude.Show, (forall x. Span -> Rep Span x)
-> (forall x. Rep Span x -> Span) -> Generic Span
forall x. Rep Span x -> Span
forall x. Span -> Rep Span x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Span x -> Span
$cfrom :: forall x. Span -> Rep Span x
Prelude.Generic)
newSpan ::
Position ->
Position ->
Span
newSpan :: Position -> Position -> Span
newSpan Position
pEnd_ Position
pStart_ =
Span' :: Position -> Position -> Span
Span' {$sel:end:Span' :: Position
end = Position
pEnd_, $sel:start:Span' :: Position
start = Position
pStart_}
span_end :: Lens.Lens' Span Position
span_end :: (Position -> f Position) -> Span -> f Span
span_end = (Span -> Position)
-> (Span -> Position -> Span) -> Lens Span Span Position Position
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Span' {Position
end :: Position
$sel:end:Span' :: Span -> Position
end} -> Position
end) (\s :: Span
s@Span' {} Position
a -> Span
s {$sel:end:Span' :: Position
end = Position
a} :: Span)
span_start :: Lens.Lens' Span Position
span_start :: (Position -> f Position) -> Span -> f Span
span_start = (Span -> Position)
-> (Span -> Position -> Span) -> Lens Span Span Position Position
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Span' {Position
start :: Position
$sel:start:Span' :: Span -> Position
start} -> Position
start) (\s :: Span
s@Span' {} Position
a -> Span
s {$sel:start:Span' :: Position
start = Position
a} :: Span)
instance Core.FromJSON Span where
parseJSON :: Value -> Parser Span
parseJSON =
String -> (Object -> Parser Span) -> Value -> Parser Span
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Span"
( \Object
x ->
Position -> Position -> Span
Span'
(Position -> Position -> Span)
-> Parser Position -> Parser (Position -> Span)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Position
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"end") Parser (Position -> Span) -> Parser Position -> Parser Span
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Position
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"start")
)
instance Prelude.Hashable Span
instance Prelude.NFData Span