{-# 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.Position where
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 Position = Position'
{
Position -> Int
line :: Prelude.Int,
Position -> Int
column :: Prelude.Int,
Position -> Int
offset :: Prelude.Int
}
deriving (Position -> Position -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Position -> Position -> Bool
$c/= :: Position -> Position -> Bool
== :: Position -> Position -> Bool
$c== :: Position -> Position -> Bool
Prelude.Eq, ReadPrec [Position]
ReadPrec Position
Int -> ReadS Position
ReadS [Position]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Position]
$creadListPrec :: ReadPrec [Position]
readPrec :: ReadPrec Position
$creadPrec :: ReadPrec Position
readList :: ReadS [Position]
$creadList :: ReadS [Position]
readsPrec :: Int -> ReadS Position
$creadsPrec :: Int -> ReadS Position
Prelude.Read, Int -> Position -> ShowS
[Position] -> ShowS
Position -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Position] -> ShowS
$cshowList :: [Position] -> ShowS
show :: Position -> String
$cshow :: Position -> String
showsPrec :: Int -> Position -> ShowS
$cshowsPrec :: Int -> Position -> ShowS
Prelude.Show, forall x. Rep Position x -> Position
forall x. Position -> Rep Position x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Position x -> Position
$cfrom :: forall x. Position -> Rep Position x
Prelude.Generic)
newPosition ::
Prelude.Int ->
Prelude.Int ->
Prelude.Int ->
Position
newPosition :: Int -> Int -> Int -> Position
newPosition Int
pLine_ Int
pColumn_ Int
pOffset_ =
Position'
{ $sel:line:Position' :: Int
line = Int
pLine_,
$sel:column:Position' :: Int
column = Int
pColumn_,
$sel:offset:Position' :: Int
offset = Int
pOffset_
}
position_line :: Lens.Lens' Position Prelude.Int
position_line :: Lens' Position Int
position_line = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Position' {Int
line :: Int
$sel:line:Position' :: Position -> Int
line} -> Int
line) (\s :: Position
s@Position' {} Int
a -> Position
s {$sel:line:Position' :: Int
line = Int
a} :: Position)
position_column :: Lens.Lens' Position Prelude.Int
position_column :: Lens' Position Int
position_column = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Position' {Int
column :: Int
$sel:column:Position' :: Position -> Int
column} -> Int
column) (\s :: Position
s@Position' {} Int
a -> Position
s {$sel:column:Position' :: Int
column = Int
a} :: Position)
position_offset :: Lens.Lens' Position Prelude.Int
position_offset :: Lens' Position Int
position_offset = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Position' {Int
offset :: Int
$sel:offset:Position' :: Position -> Int
offset} -> Int
offset) (\s :: Position
s@Position' {} Int
a -> Position
s {$sel:offset:Position' :: Int
offset = Int
a} :: Position)
instance Data.FromJSON Position where
parseJSON :: Value -> Parser Position
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Position"
( \Object
x ->
Int -> Int -> Int -> Position
Position'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"line")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"column")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"offset")
)
instance Prelude.Hashable Position where
hashWithSalt :: Int -> Position -> Int
hashWithSalt Int
_salt Position' {Int
offset :: Int
column :: Int
line :: Int
$sel:offset:Position' :: Position -> Int
$sel:column:Position' :: Position -> Int
$sel:line:Position' :: Position -> Int
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
line
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
column
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
offset
instance Prelude.NFData Position where
rnf :: Position -> ()
rnf Position' {Int
offset :: Int
column :: Int
line :: Int
$sel:offset:Position' :: Position -> Int
$sel:column:Position' :: Position -> Int
$sel:line:Position' :: Position -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
line
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
column
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
offset