{-# 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.Neptune.Types.Range where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Range = Range'
{
Range -> Maybe Int
to :: Prelude.Maybe Prelude.Int,
Range -> Maybe Int
from :: Prelude.Maybe Prelude.Int,
Range -> Maybe Int
step :: Prelude.Maybe Prelude.Int
}
deriving (Range -> Range -> Bool
(Range -> Range -> Bool) -> (Range -> Range -> Bool) -> Eq Range
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Range -> Range -> Bool
$c/= :: Range -> Range -> Bool
== :: Range -> Range -> Bool
$c== :: Range -> Range -> Bool
Prelude.Eq, ReadPrec [Range]
ReadPrec Range
Int -> ReadS Range
ReadS [Range]
(Int -> ReadS Range)
-> ReadS [Range]
-> ReadPrec Range
-> ReadPrec [Range]
-> Read Range
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Range]
$creadListPrec :: ReadPrec [Range]
readPrec :: ReadPrec Range
$creadPrec :: ReadPrec Range
readList :: ReadS [Range]
$creadList :: ReadS [Range]
readsPrec :: Int -> ReadS Range
$creadsPrec :: Int -> ReadS Range
Prelude.Read, Int -> Range -> ShowS
[Range] -> ShowS
Range -> String
(Int -> Range -> ShowS)
-> (Range -> String) -> ([Range] -> ShowS) -> Show Range
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Range] -> ShowS
$cshowList :: [Range] -> ShowS
show :: Range -> String
$cshow :: Range -> String
showsPrec :: Int -> Range -> ShowS
$cshowsPrec :: Int -> Range -> ShowS
Prelude.Show, (forall x. Range -> Rep Range x)
-> (forall x. Rep Range x -> Range) -> Generic Range
forall x. Rep Range x -> Range
forall x. Range -> Rep Range x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Range x -> Range
$cfrom :: forall x. Range -> Rep Range x
Prelude.Generic)
newRange ::
Range
newRange :: Range
newRange =
Range' :: Maybe Int -> Maybe Int -> Maybe Int -> Range
Range'
{ $sel:to:Range' :: Maybe Int
to = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:from:Range' :: Maybe Int
from = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:step:Range' :: Maybe Int
step = Maybe Int
forall a. Maybe a
Prelude.Nothing
}
range_to :: Lens.Lens' Range (Prelude.Maybe Prelude.Int)
range_to :: (Maybe Int -> f (Maybe Int)) -> Range -> f Range
range_to = (Range -> Maybe Int)
-> (Range -> Maybe Int -> Range)
-> Lens Range Range (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Range' {Maybe Int
to :: Maybe Int
$sel:to:Range' :: Range -> Maybe Int
to} -> Maybe Int
to) (\s :: Range
s@Range' {} Maybe Int
a -> Range
s {$sel:to:Range' :: Maybe Int
to = Maybe Int
a} :: Range)
range_from :: Lens.Lens' Range (Prelude.Maybe Prelude.Int)
range_from :: (Maybe Int -> f (Maybe Int)) -> Range -> f Range
range_from = (Range -> Maybe Int)
-> (Range -> Maybe Int -> Range)
-> Lens Range Range (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Range' {Maybe Int
from :: Maybe Int
$sel:from:Range' :: Range -> Maybe Int
from} -> Maybe Int
from) (\s :: Range
s@Range' {} Maybe Int
a -> Range
s {$sel:from:Range' :: Maybe Int
from = Maybe Int
a} :: Range)
range_step :: Lens.Lens' Range (Prelude.Maybe Prelude.Int)
range_step :: (Maybe Int -> f (Maybe Int)) -> Range -> f Range
range_step = (Range -> Maybe Int)
-> (Range -> Maybe Int -> Range)
-> Lens Range Range (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Range' {Maybe Int
step :: Maybe Int
$sel:step:Range' :: Range -> Maybe Int
step} -> Maybe Int
step) (\s :: Range
s@Range' {} Maybe Int
a -> Range
s {$sel:step:Range' :: Maybe Int
step = Maybe Int
a} :: Range)
instance Core.FromXML Range where
parseXML :: [Node] -> Either String Range
parseXML [Node]
x =
Maybe Int -> Maybe Int -> Maybe Int -> Range
Range'
(Maybe Int -> Maybe Int -> Maybe Int -> Range)
-> Either String (Maybe Int)
-> Either String (Maybe Int -> Maybe Int -> Range)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"To")
Either String (Maybe Int -> Maybe Int -> Range)
-> Either String (Maybe Int) -> Either String (Maybe Int -> Range)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"From")
Either String (Maybe Int -> Range)
-> Either String (Maybe Int) -> Either String Range
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Step")
instance Prelude.Hashable Range
instance Prelude.NFData Range