-- | Fairly straightforward AST encoding of the .proto grammar

{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE LambdaCase                 #-}
{-# LANGUAGE RecordWildCards            #-}

module Proto3.Suite.DotProto.AST
  ( -- * Types
      MessageName(..)
    , FieldName(..)
    , PackageName(..)
    , DotProtoIdentifier(..)
    , DotProtoImport(..)
    , DotProtoImportQualifier(..)
    , DotProtoPackageSpec(..)
    , DotProtoOption(..)
    , DotProtoDefinition(..)
    , DotProtoMeta(..)
    , DotProto(..)
    , DotProtoValue(..)
    , DotProtoPrimType(..)
    , Packing(..)
    , Path(..), fakePath
    , DotProtoType(..)
    , DotProtoEnumValue
    , DotProtoEnumPart(..)
    , Streaming(..)
    , DotProtoServicePart(..)
    , RPCMethod(..)
    , DotProtoMessagePart(..)
    , DotProtoField(..)
    , DotProtoReservedField(..)
  ) where

import           Control.Applicative
import           Data.Char                 (toLower)
import           Control.Monad
import           Data.Data                 (Data)
import           Data.Int                  (Int32)
import qualified Data.List.NonEmpty        as NE
import           Data.String               (IsString(..))
import           GHC.Generics              (Generic)
import           Numeric.Natural
import           Prelude                   hiding (FilePath)
import           Proto3.Wire.Types         (FieldNumber (..))
import           Test.QuickCheck
import           Test.QuickCheck.Instances ()
import           Text.PrettyPrint          ((<+>))
import qualified Text.PrettyPrint          as PP
import           Text.PrettyPrint.HughesPJClass (Pretty(..))
import           Turtle                    (FilePath)
import           Turtle.Compat             (encodeString)

-- | The name of a message
newtype MessageName = MessageName
  { MessageName -> String
getMessageName :: String }
  deriving (Typeable MessageName
Typeable MessageName =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> MessageName -> c MessageName)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c MessageName)
-> (MessageName -> Constr)
-> (MessageName -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c MessageName))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c MessageName))
-> ((forall b. Data b => b -> b) -> MessageName -> MessageName)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> MessageName -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> MessageName -> r)
-> (forall u. (forall d. Data d => d -> u) -> MessageName -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> MessageName -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> MessageName -> m MessageName)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> MessageName -> m MessageName)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> MessageName -> m MessageName)
-> Data MessageName
MessageName -> Constr
MessageName -> DataType
(forall b. Data b => b -> b) -> MessageName -> MessageName
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> MessageName -> u
forall u. (forall d. Data d => d -> u) -> MessageName -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> MessageName -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> MessageName -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> MessageName -> m MessageName
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> MessageName -> m MessageName
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c MessageName
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MessageName -> c MessageName
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c MessageName)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c MessageName)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MessageName -> c MessageName
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MessageName -> c MessageName
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c MessageName
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c MessageName
$ctoConstr :: MessageName -> Constr
toConstr :: MessageName -> Constr
$cdataTypeOf :: MessageName -> DataType
dataTypeOf :: MessageName -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c MessageName)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c MessageName)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c MessageName)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c MessageName)
$cgmapT :: (forall b. Data b => b -> b) -> MessageName -> MessageName
gmapT :: (forall b. Data b => b -> b) -> MessageName -> MessageName
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> MessageName -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> MessageName -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> MessageName -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> MessageName -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> MessageName -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> MessageName -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> MessageName -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> MessageName -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> MessageName -> m MessageName
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> MessageName -> m MessageName
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> MessageName -> m MessageName
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> MessageName -> m MessageName
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> MessageName -> m MessageName
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> MessageName -> m MessageName
Data, MessageName -> MessageName -> Bool
(MessageName -> MessageName -> Bool)
-> (MessageName -> MessageName -> Bool) -> Eq MessageName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MessageName -> MessageName -> Bool
== :: MessageName -> MessageName -> Bool
$c/= :: MessageName -> MessageName -> Bool
/= :: MessageName -> MessageName -> Bool
Eq, (forall x. MessageName -> Rep MessageName x)
-> (forall x. Rep MessageName x -> MessageName)
-> Generic MessageName
forall x. Rep MessageName x -> MessageName
forall x. MessageName -> Rep MessageName x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. MessageName -> Rep MessageName x
from :: forall x. MessageName -> Rep MessageName x
$cto :: forall x. Rep MessageName x -> MessageName
to :: forall x. Rep MessageName x -> MessageName
Generic, String -> MessageName
(String -> MessageName) -> IsString MessageName
forall a. (String -> a) -> IsString a
$cfromString :: String -> MessageName
fromString :: String -> MessageName
IsString, Eq MessageName
Eq MessageName =>
(MessageName -> MessageName -> Ordering)
-> (MessageName -> MessageName -> Bool)
-> (MessageName -> MessageName -> Bool)
-> (MessageName -> MessageName -> Bool)
-> (MessageName -> MessageName -> Bool)
-> (MessageName -> MessageName -> MessageName)
-> (MessageName -> MessageName -> MessageName)
-> Ord MessageName
MessageName -> MessageName -> Bool
MessageName -> MessageName -> Ordering
MessageName -> MessageName -> MessageName
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: MessageName -> MessageName -> Ordering
compare :: MessageName -> MessageName -> Ordering
$c< :: MessageName -> MessageName -> Bool
< :: MessageName -> MessageName -> Bool
$c<= :: MessageName -> MessageName -> Bool
<= :: MessageName -> MessageName -> Bool
$c> :: MessageName -> MessageName -> Bool
> :: MessageName -> MessageName -> Bool
$c>= :: MessageName -> MessageName -> Bool
>= :: MessageName -> MessageName -> Bool
$cmax :: MessageName -> MessageName -> MessageName
max :: MessageName -> MessageName -> MessageName
$cmin :: MessageName -> MessageName -> MessageName
min :: MessageName -> MessageName -> MessageName
Ord)

instance Show MessageName where
  show :: MessageName -> String
show = String -> String
forall a. Show a => a -> String
show (String -> String)
-> (MessageName -> String) -> MessageName -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. MessageName -> String
getMessageName

-- | The name of some field
newtype FieldName = FieldName
  { FieldName -> String
getFieldName :: String }
  deriving (Typeable FieldName
Typeable FieldName =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> FieldName -> c FieldName)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c FieldName)
-> (FieldName -> Constr)
-> (FieldName -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c FieldName))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FieldName))
-> ((forall b. Data b => b -> b) -> FieldName -> FieldName)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> FieldName -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> FieldName -> r)
-> (forall u. (forall d. Data d => d -> u) -> FieldName -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> FieldName -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> FieldName -> m FieldName)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> FieldName -> m FieldName)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> FieldName -> m FieldName)
-> Data FieldName
FieldName -> Constr
FieldName -> DataType
(forall b. Data b => b -> b) -> FieldName -> FieldName
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> FieldName -> u
forall u. (forall d. Data d => d -> u) -> FieldName -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FieldName -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FieldName -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FieldName -> m FieldName
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FieldName -> m FieldName
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FieldName
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FieldName -> c FieldName
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FieldName)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FieldName)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FieldName -> c FieldName
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FieldName -> c FieldName
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FieldName
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FieldName
$ctoConstr :: FieldName -> Constr
toConstr :: FieldName -> Constr
$cdataTypeOf :: FieldName -> DataType
dataTypeOf :: FieldName -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FieldName)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FieldName)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FieldName)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FieldName)
$cgmapT :: (forall b. Data b => b -> b) -> FieldName -> FieldName
gmapT :: (forall b. Data b => b -> b) -> FieldName -> FieldName
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FieldName -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FieldName -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FieldName -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FieldName -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FieldName -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> FieldName -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FieldName -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FieldName -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FieldName -> m FieldName
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FieldName -> m FieldName
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FieldName -> m FieldName
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FieldName -> m FieldName
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FieldName -> m FieldName
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FieldName -> m FieldName
Data, FieldName -> FieldName -> Bool
(FieldName -> FieldName -> Bool)
-> (FieldName -> FieldName -> Bool) -> Eq FieldName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FieldName -> FieldName -> Bool
== :: FieldName -> FieldName -> Bool
$c/= :: FieldName -> FieldName -> Bool
/= :: FieldName -> FieldName -> Bool
Eq, (forall x. FieldName -> Rep FieldName x)
-> (forall x. Rep FieldName x -> FieldName) -> Generic FieldName
forall x. Rep FieldName x -> FieldName
forall x. FieldName -> Rep FieldName x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FieldName -> Rep FieldName x
from :: forall x. FieldName -> Rep FieldName x
$cto :: forall x. Rep FieldName x -> FieldName
to :: forall x. Rep FieldName x -> FieldName
Generic, String -> FieldName
(String -> FieldName) -> IsString FieldName
forall a. (String -> a) -> IsString a
$cfromString :: String -> FieldName
fromString :: String -> FieldName
IsString, Eq FieldName
Eq FieldName =>
(FieldName -> FieldName -> Ordering)
-> (FieldName -> FieldName -> Bool)
-> (FieldName -> FieldName -> Bool)
-> (FieldName -> FieldName -> Bool)
-> (FieldName -> FieldName -> Bool)
-> (FieldName -> FieldName -> FieldName)
-> (FieldName -> FieldName -> FieldName)
-> Ord FieldName
FieldName -> FieldName -> Bool
FieldName -> FieldName -> Ordering
FieldName -> FieldName -> FieldName
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: FieldName -> FieldName -> Ordering
compare :: FieldName -> FieldName -> Ordering
$c< :: FieldName -> FieldName -> Bool
< :: FieldName -> FieldName -> Bool
$c<= :: FieldName -> FieldName -> Bool
<= :: FieldName -> FieldName -> Bool
$c> :: FieldName -> FieldName -> Bool
> :: FieldName -> FieldName -> Bool
$c>= :: FieldName -> FieldName -> Bool
>= :: FieldName -> FieldName -> Bool
$cmax :: FieldName -> FieldName -> FieldName
max :: FieldName -> FieldName -> FieldName
$cmin :: FieldName -> FieldName -> FieldName
min :: FieldName -> FieldName -> FieldName
Ord)

instance Show FieldName where
  show :: FieldName -> String
show = String -> String
forall a. Show a => a -> String
show (String -> String) -> (FieldName -> String) -> FieldName -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FieldName -> String
getFieldName

-- | The name of the package
newtype PackageName = PackageName
  { PackageName -> String
getPackageName :: String }
  deriving (Typeable PackageName
Typeable PackageName =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> PackageName -> c PackageName)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c PackageName)
-> (PackageName -> Constr)
-> (PackageName -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c PackageName))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c PackageName))
-> ((forall b. Data b => b -> b) -> PackageName -> PackageName)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> PackageName -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> PackageName -> r)
-> (forall u. (forall d. Data d => d -> u) -> PackageName -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> PackageName -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> PackageName -> m PackageName)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> PackageName -> m PackageName)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> PackageName -> m PackageName)
-> Data PackageName
PackageName -> Constr
PackageName -> DataType
(forall b. Data b => b -> b) -> PackageName -> PackageName
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> PackageName -> u
forall u. (forall d. Data d => d -> u) -> PackageName -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PackageName -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PackageName -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> PackageName -> m PackageName
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> PackageName -> m PackageName
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PackageName
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PackageName -> c PackageName
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c PackageName)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c PackageName)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PackageName -> c PackageName
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PackageName -> c PackageName
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PackageName
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PackageName
$ctoConstr :: PackageName -> Constr
toConstr :: PackageName -> Constr
$cdataTypeOf :: PackageName -> DataType
dataTypeOf :: PackageName -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c PackageName)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c PackageName)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c PackageName)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c PackageName)
$cgmapT :: (forall b. Data b => b -> b) -> PackageName -> PackageName
gmapT :: (forall b. Data b => b -> b) -> PackageName -> PackageName
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PackageName -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PackageName -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PackageName -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PackageName -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> PackageName -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> PackageName -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> PackageName -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> PackageName -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> PackageName -> m PackageName
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> PackageName -> m PackageName
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> PackageName -> m PackageName
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> PackageName -> m PackageName
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> PackageName -> m PackageName
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> PackageName -> m PackageName
Data, PackageName -> PackageName -> Bool
(PackageName -> PackageName -> Bool)
-> (PackageName -> PackageName -> Bool) -> Eq PackageName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PackageName -> PackageName -> Bool
== :: PackageName -> PackageName -> Bool
$c/= :: PackageName -> PackageName -> Bool
/= :: PackageName -> PackageName -> Bool
Eq, (forall x. PackageName -> Rep PackageName x)
-> (forall x. Rep PackageName x -> PackageName)
-> Generic PackageName
forall x. Rep PackageName x -> PackageName
forall x. PackageName -> Rep PackageName x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. PackageName -> Rep PackageName x
from :: forall x. PackageName -> Rep PackageName x
$cto :: forall x. Rep PackageName x -> PackageName
to :: forall x. Rep PackageName x -> PackageName
Generic, String -> PackageName
(String -> PackageName) -> IsString PackageName
forall a. (String -> a) -> IsString a
$cfromString :: String -> PackageName
fromString :: String -> PackageName
IsString, Eq PackageName
Eq PackageName =>
(PackageName -> PackageName -> Ordering)
-> (PackageName -> PackageName -> Bool)
-> (PackageName -> PackageName -> Bool)
-> (PackageName -> PackageName -> Bool)
-> (PackageName -> PackageName -> Bool)
-> (PackageName -> PackageName -> PackageName)
-> (PackageName -> PackageName -> PackageName)
-> Ord PackageName
PackageName -> PackageName -> Bool
PackageName -> PackageName -> Ordering
PackageName -> PackageName -> PackageName
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: PackageName -> PackageName -> Ordering
compare :: PackageName -> PackageName -> Ordering
$c< :: PackageName -> PackageName -> Bool
< :: PackageName -> PackageName -> Bool
$c<= :: PackageName -> PackageName -> Bool
<= :: PackageName -> PackageName -> Bool
$c> :: PackageName -> PackageName -> Bool
> :: PackageName -> PackageName -> Bool
$c>= :: PackageName -> PackageName -> Bool
>= :: PackageName -> PackageName -> Bool
$cmax :: PackageName -> PackageName -> PackageName
max :: PackageName -> PackageName -> PackageName
$cmin :: PackageName -> PackageName -> PackageName
min :: PackageName -> PackageName -> PackageName
Ord)

instance Show PackageName where
  show :: PackageName -> String
show = String -> String
forall a. Show a => a -> String
show (String -> String)
-> (PackageName -> String) -> PackageName -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PackageName -> String
getPackageName

newtype Path = Path
  { Path -> NonEmpty String
components :: NE.NonEmpty String }
  deriving (Typeable Path
Typeable Path =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> Path -> c Path)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Path)
-> (Path -> Constr)
-> (Path -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Path))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Path))
-> ((forall b. Data b => b -> b) -> Path -> Path)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Path -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Path -> r)
-> (forall u. (forall d. Data d => d -> u) -> Path -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Path -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Path -> m Path)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Path -> m Path)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Path -> m Path)
-> Data Path
Path -> Constr
Path -> DataType
(forall b. Data b => b -> b) -> Path -> Path
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Path -> u
forall u. (forall d. Data d => d -> u) -> Path -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Path -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Path -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Path -> m Path
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Path -> m Path
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Path
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Path -> c Path
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Path)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Path)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Path -> c Path
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Path -> c Path
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Path
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Path
$ctoConstr :: Path -> Constr
toConstr :: Path -> Constr
$cdataTypeOf :: Path -> DataType
dataTypeOf :: Path -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Path)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Path)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Path)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Path)
$cgmapT :: (forall b. Data b => b -> b) -> Path -> Path
gmapT :: (forall b. Data b => b -> b) -> Path -> Path
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Path -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Path -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Path -> r
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Path -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Path -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> Path -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Path -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Path -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Path -> m Path
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Path -> m Path
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Path -> m Path
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Path -> m Path
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Path -> m Path
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Path -> m Path
Data, Path -> Path -> Bool
(Path -> Path -> Bool) -> (Path -> Path -> Bool) -> Eq Path
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Path -> Path -> Bool
== :: Path -> Path -> Bool
$c/= :: Path -> Path -> Bool
/= :: Path -> Path -> Bool
Eq, (forall x. Path -> Rep Path x)
-> (forall x. Rep Path x -> Path) -> Generic Path
forall x. Rep Path x -> Path
forall x. Path -> Rep Path x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Path -> Rep Path x
from :: forall x. Path -> Rep Path x
$cto :: forall x. Rep Path x -> Path
to :: forall x. Rep Path x -> Path
Generic, Eq Path
Eq Path =>
(Path -> Path -> Ordering)
-> (Path -> Path -> Bool)
-> (Path -> Path -> Bool)
-> (Path -> Path -> Bool)
-> (Path -> Path -> Bool)
-> (Path -> Path -> Path)
-> (Path -> Path -> Path)
-> Ord Path
Path -> Path -> Bool
Path -> Path -> Ordering
Path -> Path -> Path
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Path -> Path -> Ordering
compare :: Path -> Path -> Ordering
$c< :: Path -> Path -> Bool
< :: Path -> Path -> Bool
$c<= :: Path -> Path -> Bool
<= :: Path -> Path -> Bool
$c> :: Path -> Path -> Bool
> :: Path -> Path -> Bool
$c>= :: Path -> Path -> Bool
>= :: Path -> Path -> Bool
$cmax :: Path -> Path -> Path
max :: Path -> Path -> Path
$cmin :: Path -> Path -> Path
min :: Path -> Path -> Path
Ord, Int -> Path -> String -> String
[Path] -> String -> String
Path -> String
(Int -> Path -> String -> String)
-> (Path -> String) -> ([Path] -> String -> String) -> Show Path
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> Path -> String -> String
showsPrec :: Int -> Path -> String -> String
$cshow :: Path -> String
show :: Path -> String
$cshowList :: [Path] -> String -> String
showList :: [Path] -> String -> String
Show)

-- Used for testing
fakePath :: Path
fakePath :: Path
fakePath = NonEmpty String -> Path
Path (String
"fakePath" String -> [String] -> NonEmpty String
forall a. a -> [a] -> NonEmpty a
NE.:| [])

data DotProtoIdentifier
  = Single String
  | Dots   Path
  | Qualified DotProtoIdentifier DotProtoIdentifier
  | Anonymous -- [recheck] is there a better way to represent unnamed things
  deriving (Typeable DotProtoIdentifier
Typeable DotProtoIdentifier =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g)
 -> DotProtoIdentifier
 -> c DotProtoIdentifier)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c DotProtoIdentifier)
-> (DotProtoIdentifier -> Constr)
-> (DotProtoIdentifier -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c DotProtoIdentifier))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c DotProtoIdentifier))
-> ((forall b. Data b => b -> b)
    -> DotProtoIdentifier -> DotProtoIdentifier)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoIdentifier -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoIdentifier -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> DotProtoIdentifier -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> DotProtoIdentifier -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> DotProtoIdentifier -> m DotProtoIdentifier)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> DotProtoIdentifier -> m DotProtoIdentifier)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> DotProtoIdentifier -> m DotProtoIdentifier)
-> Data DotProtoIdentifier
DotProtoIdentifier -> Constr
DotProtoIdentifier -> DataType
(forall b. Data b => b -> b)
-> DotProtoIdentifier -> DotProtoIdentifier
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoIdentifier -> u
forall u. (forall d. Data d => d -> u) -> DotProtoIdentifier -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoIdentifier -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoIdentifier -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoIdentifier -> m DotProtoIdentifier
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoIdentifier -> m DotProtoIdentifier
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoIdentifier
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> DotProtoIdentifier
-> c DotProtoIdentifier
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoIdentifier)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoIdentifier)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> DotProtoIdentifier
-> c DotProtoIdentifier
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> DotProtoIdentifier
-> c DotProtoIdentifier
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoIdentifier
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoIdentifier
$ctoConstr :: DotProtoIdentifier -> Constr
toConstr :: DotProtoIdentifier -> Constr
$cdataTypeOf :: DotProtoIdentifier -> DataType
dataTypeOf :: DotProtoIdentifier -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoIdentifier)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoIdentifier)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoIdentifier)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoIdentifier)
$cgmapT :: (forall b. Data b => b -> b)
-> DotProtoIdentifier -> DotProtoIdentifier
gmapT :: (forall b. Data b => b -> b)
-> DotProtoIdentifier -> DotProtoIdentifier
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoIdentifier -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoIdentifier -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoIdentifier -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoIdentifier -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> DotProtoIdentifier -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> DotProtoIdentifier -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoIdentifier -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoIdentifier -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoIdentifier -> m DotProtoIdentifier
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoIdentifier -> m DotProtoIdentifier
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoIdentifier -> m DotProtoIdentifier
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoIdentifier -> m DotProtoIdentifier
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoIdentifier -> m DotProtoIdentifier
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoIdentifier -> m DotProtoIdentifier
Data, DotProtoIdentifier -> DotProtoIdentifier -> Bool
(DotProtoIdentifier -> DotProtoIdentifier -> Bool)
-> (DotProtoIdentifier -> DotProtoIdentifier -> Bool)
-> Eq DotProtoIdentifier
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DotProtoIdentifier -> DotProtoIdentifier -> Bool
== :: DotProtoIdentifier -> DotProtoIdentifier -> Bool
$c/= :: DotProtoIdentifier -> DotProtoIdentifier -> Bool
/= :: DotProtoIdentifier -> DotProtoIdentifier -> Bool
Eq, (forall x. DotProtoIdentifier -> Rep DotProtoIdentifier x)
-> (forall x. Rep DotProtoIdentifier x -> DotProtoIdentifier)
-> Generic DotProtoIdentifier
forall x. Rep DotProtoIdentifier x -> DotProtoIdentifier
forall x. DotProtoIdentifier -> Rep DotProtoIdentifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. DotProtoIdentifier -> Rep DotProtoIdentifier x
from :: forall x. DotProtoIdentifier -> Rep DotProtoIdentifier x
$cto :: forall x. Rep DotProtoIdentifier x -> DotProtoIdentifier
to :: forall x. Rep DotProtoIdentifier x -> DotProtoIdentifier
Generic, Eq DotProtoIdentifier
Eq DotProtoIdentifier =>
(DotProtoIdentifier -> DotProtoIdentifier -> Ordering)
-> (DotProtoIdentifier -> DotProtoIdentifier -> Bool)
-> (DotProtoIdentifier -> DotProtoIdentifier -> Bool)
-> (DotProtoIdentifier -> DotProtoIdentifier -> Bool)
-> (DotProtoIdentifier -> DotProtoIdentifier -> Bool)
-> (DotProtoIdentifier -> DotProtoIdentifier -> DotProtoIdentifier)
-> (DotProtoIdentifier -> DotProtoIdentifier -> DotProtoIdentifier)
-> Ord DotProtoIdentifier
DotProtoIdentifier -> DotProtoIdentifier -> Bool
DotProtoIdentifier -> DotProtoIdentifier -> Ordering
DotProtoIdentifier -> DotProtoIdentifier -> DotProtoIdentifier
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: DotProtoIdentifier -> DotProtoIdentifier -> Ordering
compare :: DotProtoIdentifier -> DotProtoIdentifier -> Ordering
$c< :: DotProtoIdentifier -> DotProtoIdentifier -> Bool
< :: DotProtoIdentifier -> DotProtoIdentifier -> Bool
$c<= :: DotProtoIdentifier -> DotProtoIdentifier -> Bool
<= :: DotProtoIdentifier -> DotProtoIdentifier -> Bool
$c> :: DotProtoIdentifier -> DotProtoIdentifier -> Bool
> :: DotProtoIdentifier -> DotProtoIdentifier -> Bool
$c>= :: DotProtoIdentifier -> DotProtoIdentifier -> Bool
>= :: DotProtoIdentifier -> DotProtoIdentifier -> Bool
$cmax :: DotProtoIdentifier -> DotProtoIdentifier -> DotProtoIdentifier
max :: DotProtoIdentifier -> DotProtoIdentifier -> DotProtoIdentifier
$cmin :: DotProtoIdentifier -> DotProtoIdentifier -> DotProtoIdentifier
min :: DotProtoIdentifier -> DotProtoIdentifier -> DotProtoIdentifier
Ord, Int -> DotProtoIdentifier -> String -> String
[DotProtoIdentifier] -> String -> String
DotProtoIdentifier -> String
(Int -> DotProtoIdentifier -> String -> String)
-> (DotProtoIdentifier -> String)
-> ([DotProtoIdentifier] -> String -> String)
-> Show DotProtoIdentifier
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> DotProtoIdentifier -> String -> String
showsPrec :: Int -> DotProtoIdentifier -> String -> String
$cshow :: DotProtoIdentifier -> String
show :: DotProtoIdentifier -> String
$cshowList :: [DotProtoIdentifier] -> String -> String
showList :: [DotProtoIdentifier] -> String -> String
Show)

instance Pretty DotProtoIdentifier where
  pPrint :: DotProtoIdentifier -> Doc
pPrint (Single String
name)                    = String -> Doc
PP.text String
name
  pPrint (Dots (Path NonEmpty String
names))              = [Doc] -> Doc
PP.hcat ([Doc] -> Doc) -> ([Doc] -> [Doc]) -> [Doc] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> [Doc] -> [Doc]
PP.punctuate (String -> Doc
PP.text String
".") ([Doc] -> Doc) -> [Doc] -> Doc
forall a b. (a -> b) -> a -> b
$ String -> Doc
PP.text (String -> Doc) -> [String] -> [Doc]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> NonEmpty String -> [String]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty String
names
  pPrint (Qualified DotProtoIdentifier
qualifier DotProtoIdentifier
identifier) = Doc -> Doc
PP.parens (DotProtoIdentifier -> Doc
forall a. Pretty a => a -> Doc
pPrint DotProtoIdentifier
qualifier) Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
PP.text String
"." Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> DotProtoIdentifier -> Doc
forall a. Pretty a => a -> Doc
pPrint DotProtoIdentifier
identifier
  pPrint DotProtoIdentifier
Anonymous                        = Doc
PP.empty

-- | Top-level import declaration
data DotProtoImport = DotProtoImport
  { DotProtoImport -> DotProtoImportQualifier
dotProtoImportQualifier :: DotProtoImportQualifier
  , DotProtoImport -> String
dotProtoImportPath      :: FilePath
  }
  deriving (Typeable DotProtoImport
Typeable DotProtoImport =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> DotProtoImport -> c DotProtoImport)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c DotProtoImport)
-> (DotProtoImport -> Constr)
-> (DotProtoImport -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c DotProtoImport))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c DotProtoImport))
-> ((forall b. Data b => b -> b)
    -> DotProtoImport -> DotProtoImport)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoImport -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoImport -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> DotProtoImport -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> DotProtoImport -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> DotProtoImport -> m DotProtoImport)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> DotProtoImport -> m DotProtoImport)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> DotProtoImport -> m DotProtoImport)
-> Data DotProtoImport
DotProtoImport -> Constr
DotProtoImport -> DataType
(forall b. Data b => b -> b) -> DotProtoImport -> DotProtoImport
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoImport -> u
forall u. (forall d. Data d => d -> u) -> DotProtoImport -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoImport -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoImport -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoImport -> m DotProtoImport
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoImport -> m DotProtoImport
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoImport
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProtoImport -> c DotProtoImport
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoImport)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoImport)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProtoImport -> c DotProtoImport
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProtoImport -> c DotProtoImport
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoImport
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoImport
$ctoConstr :: DotProtoImport -> Constr
toConstr :: DotProtoImport -> Constr
$cdataTypeOf :: DotProtoImport -> DataType
dataTypeOf :: DotProtoImport -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoImport)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoImport)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoImport)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoImport)
$cgmapT :: (forall b. Data b => b -> b) -> DotProtoImport -> DotProtoImport
gmapT :: (forall b. Data b => b -> b) -> DotProtoImport -> DotProtoImport
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoImport -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoImport -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoImport -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoImport -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> DotProtoImport -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> DotProtoImport -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoImport -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoImport -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoImport -> m DotProtoImport
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoImport -> m DotProtoImport
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoImport -> m DotProtoImport
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoImport -> m DotProtoImport
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoImport -> m DotProtoImport
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoImport -> m DotProtoImport
Data, DotProtoImport -> DotProtoImport -> Bool
(DotProtoImport -> DotProtoImport -> Bool)
-> (DotProtoImport -> DotProtoImport -> Bool) -> Eq DotProtoImport
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DotProtoImport -> DotProtoImport -> Bool
== :: DotProtoImport -> DotProtoImport -> Bool
$c/= :: DotProtoImport -> DotProtoImport -> Bool
/= :: DotProtoImport -> DotProtoImport -> Bool
Eq, (forall x. DotProtoImport -> Rep DotProtoImport x)
-> (forall x. Rep DotProtoImport x -> DotProtoImport)
-> Generic DotProtoImport
forall x. Rep DotProtoImport x -> DotProtoImport
forall x. DotProtoImport -> Rep DotProtoImport x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. DotProtoImport -> Rep DotProtoImport x
from :: forall x. DotProtoImport -> Rep DotProtoImport x
$cto :: forall x. Rep DotProtoImport x -> DotProtoImport
to :: forall x. Rep DotProtoImport x -> DotProtoImport
Generic, Eq DotProtoImport
Eq DotProtoImport =>
(DotProtoImport -> DotProtoImport -> Ordering)
-> (DotProtoImport -> DotProtoImport -> Bool)
-> (DotProtoImport -> DotProtoImport -> Bool)
-> (DotProtoImport -> DotProtoImport -> Bool)
-> (DotProtoImport -> DotProtoImport -> Bool)
-> (DotProtoImport -> DotProtoImport -> DotProtoImport)
-> (DotProtoImport -> DotProtoImport -> DotProtoImport)
-> Ord DotProtoImport
DotProtoImport -> DotProtoImport -> Bool
DotProtoImport -> DotProtoImport -> Ordering
DotProtoImport -> DotProtoImport -> DotProtoImport
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: DotProtoImport -> DotProtoImport -> Ordering
compare :: DotProtoImport -> DotProtoImport -> Ordering
$c< :: DotProtoImport -> DotProtoImport -> Bool
< :: DotProtoImport -> DotProtoImport -> Bool
$c<= :: DotProtoImport -> DotProtoImport -> Bool
<= :: DotProtoImport -> DotProtoImport -> Bool
$c> :: DotProtoImport -> DotProtoImport -> Bool
> :: DotProtoImport -> DotProtoImport -> Bool
$c>= :: DotProtoImport -> DotProtoImport -> Bool
>= :: DotProtoImport -> DotProtoImport -> Bool
$cmax :: DotProtoImport -> DotProtoImport -> DotProtoImport
max :: DotProtoImport -> DotProtoImport -> DotProtoImport
$cmin :: DotProtoImport -> DotProtoImport -> DotProtoImport
min :: DotProtoImport -> DotProtoImport -> DotProtoImport
Ord, Int -> DotProtoImport -> String -> String
[DotProtoImport] -> String -> String
DotProtoImport -> String
(Int -> DotProtoImport -> String -> String)
-> (DotProtoImport -> String)
-> ([DotProtoImport] -> String -> String)
-> Show DotProtoImport
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> DotProtoImport -> String -> String
showsPrec :: Int -> DotProtoImport -> String -> String
$cshow :: DotProtoImport -> String
show :: DotProtoImport -> String
$cshowList :: [DotProtoImport] -> String -> String
showList :: [DotProtoImport] -> String -> String
Show)

instance Pretty DotProtoImport where
  pPrint :: DotProtoImport -> Doc
pPrint (DotProtoImport DotProtoImportQualifier
q String
i) =
    String -> Doc
PP.text String
"import" Doc -> Doc -> Doc
<+> DotProtoImportQualifier -> Doc
forall a. Pretty a => a -> Doc
pPrint DotProtoImportQualifier
q Doc -> Doc -> Doc
<+> String -> Doc
strLit String
fp Doc -> Doc -> Doc
PP.<> String -> Doc
PP.text String
";"
    where
      fp :: String
fp = String -> String
encodeString String
i

instance Arbitrary DotProtoImport where
  arbitrary :: Gen DotProtoImport
arbitrary = do
    DotProtoImportQualifier
dotProtoImportQualifier <- Gen DotProtoImportQualifier
forall a. Arbitrary a => Gen a
arbitrary
    String
dotProtoImportPath <- (String -> String) -> Gen String -> Gen String
forall a b. (a -> b) -> Gen a -> Gen b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> String
forall a. IsString a => String -> a
fromString Gen String
forall a. Arbitrary a => Gen a
arbitrary
    DotProtoImport -> Gen DotProtoImport
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return (DotProtoImport {String
DotProtoImportQualifier
dotProtoImportQualifier :: DotProtoImportQualifier
dotProtoImportPath :: String
dotProtoImportQualifier :: DotProtoImportQualifier
dotProtoImportPath :: String
..})

data DotProtoImportQualifier
  = DotProtoImportPublic
  | DotProtoImportWeak
  | DotProtoImportDefault
  deriving (DotProtoImportQualifier
DotProtoImportQualifier
-> DotProtoImportQualifier -> Bounded DotProtoImportQualifier
forall a. a -> a -> Bounded a
$cminBound :: DotProtoImportQualifier
minBound :: DotProtoImportQualifier
$cmaxBound :: DotProtoImportQualifier
maxBound :: DotProtoImportQualifier
Bounded, Typeable DotProtoImportQualifier
Typeable DotProtoImportQualifier =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g)
 -> DotProtoImportQualifier
 -> c DotProtoImportQualifier)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c DotProtoImportQualifier)
-> (DotProtoImportQualifier -> Constr)
-> (DotProtoImportQualifier -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c DotProtoImportQualifier))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c DotProtoImportQualifier))
-> ((forall b. Data b => b -> b)
    -> DotProtoImportQualifier -> DotProtoImportQualifier)
-> (forall r r'.
    (r -> r' -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> DotProtoImportQualifier
    -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> DotProtoImportQualifier
    -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> DotProtoImportQualifier -> [u])
-> (forall u.
    Int
    -> (forall d. Data d => d -> u) -> DotProtoImportQualifier -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> DotProtoImportQualifier -> m DotProtoImportQualifier)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> DotProtoImportQualifier -> m DotProtoImportQualifier)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> DotProtoImportQualifier -> m DotProtoImportQualifier)
-> Data DotProtoImportQualifier
DotProtoImportQualifier -> Constr
DotProtoImportQualifier -> DataType
(forall b. Data b => b -> b)
-> DotProtoImportQualifier -> DotProtoImportQualifier
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoImportQualifier -> u
forall u.
(forall d. Data d => d -> u) -> DotProtoImportQualifier -> [u]
forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> DotProtoImportQualifier
-> r
forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> DotProtoImportQualifier
-> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoImportQualifier -> m DotProtoImportQualifier
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoImportQualifier -> m DotProtoImportQualifier
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoImportQualifier
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> DotProtoImportQualifier
-> c DotProtoImportQualifier
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoImportQualifier)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoImportQualifier)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> DotProtoImportQualifier
-> c DotProtoImportQualifier
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> DotProtoImportQualifier
-> c DotProtoImportQualifier
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoImportQualifier
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoImportQualifier
$ctoConstr :: DotProtoImportQualifier -> Constr
toConstr :: DotProtoImportQualifier -> Constr
$cdataTypeOf :: DotProtoImportQualifier -> DataType
dataTypeOf :: DotProtoImportQualifier -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoImportQualifier)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoImportQualifier)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoImportQualifier)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoImportQualifier)
$cgmapT :: (forall b. Data b => b -> b)
-> DotProtoImportQualifier -> DotProtoImportQualifier
gmapT :: (forall b. Data b => b -> b)
-> DotProtoImportQualifier -> DotProtoImportQualifier
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> DotProtoImportQualifier
-> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> DotProtoImportQualifier
-> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> DotProtoImportQualifier
-> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> DotProtoImportQualifier
-> r
$cgmapQ :: forall u.
(forall d. Data d => d -> u) -> DotProtoImportQualifier -> [u]
gmapQ :: forall u.
(forall d. Data d => d -> u) -> DotProtoImportQualifier -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoImportQualifier -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoImportQualifier -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoImportQualifier -> m DotProtoImportQualifier
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoImportQualifier -> m DotProtoImportQualifier
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoImportQualifier -> m DotProtoImportQualifier
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoImportQualifier -> m DotProtoImportQualifier
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoImportQualifier -> m DotProtoImportQualifier
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoImportQualifier -> m DotProtoImportQualifier
Data, Int -> DotProtoImportQualifier
DotProtoImportQualifier -> Int
DotProtoImportQualifier -> [DotProtoImportQualifier]
DotProtoImportQualifier -> DotProtoImportQualifier
DotProtoImportQualifier
-> DotProtoImportQualifier -> [DotProtoImportQualifier]
DotProtoImportQualifier
-> DotProtoImportQualifier
-> DotProtoImportQualifier
-> [DotProtoImportQualifier]
(DotProtoImportQualifier -> DotProtoImportQualifier)
-> (DotProtoImportQualifier -> DotProtoImportQualifier)
-> (Int -> DotProtoImportQualifier)
-> (DotProtoImportQualifier -> Int)
-> (DotProtoImportQualifier -> [DotProtoImportQualifier])
-> (DotProtoImportQualifier
    -> DotProtoImportQualifier -> [DotProtoImportQualifier])
-> (DotProtoImportQualifier
    -> DotProtoImportQualifier -> [DotProtoImportQualifier])
-> (DotProtoImportQualifier
    -> DotProtoImportQualifier
    -> DotProtoImportQualifier
    -> [DotProtoImportQualifier])
-> Enum DotProtoImportQualifier
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: DotProtoImportQualifier -> DotProtoImportQualifier
succ :: DotProtoImportQualifier -> DotProtoImportQualifier
$cpred :: DotProtoImportQualifier -> DotProtoImportQualifier
pred :: DotProtoImportQualifier -> DotProtoImportQualifier
$ctoEnum :: Int -> DotProtoImportQualifier
toEnum :: Int -> DotProtoImportQualifier
$cfromEnum :: DotProtoImportQualifier -> Int
fromEnum :: DotProtoImportQualifier -> Int
$cenumFrom :: DotProtoImportQualifier -> [DotProtoImportQualifier]
enumFrom :: DotProtoImportQualifier -> [DotProtoImportQualifier]
$cenumFromThen :: DotProtoImportQualifier
-> DotProtoImportQualifier -> [DotProtoImportQualifier]
enumFromThen :: DotProtoImportQualifier
-> DotProtoImportQualifier -> [DotProtoImportQualifier]
$cenumFromTo :: DotProtoImportQualifier
-> DotProtoImportQualifier -> [DotProtoImportQualifier]
enumFromTo :: DotProtoImportQualifier
-> DotProtoImportQualifier -> [DotProtoImportQualifier]
$cenumFromThenTo :: DotProtoImportQualifier
-> DotProtoImportQualifier
-> DotProtoImportQualifier
-> [DotProtoImportQualifier]
enumFromThenTo :: DotProtoImportQualifier
-> DotProtoImportQualifier
-> DotProtoImportQualifier
-> [DotProtoImportQualifier]
Enum, DotProtoImportQualifier -> DotProtoImportQualifier -> Bool
(DotProtoImportQualifier -> DotProtoImportQualifier -> Bool)
-> (DotProtoImportQualifier -> DotProtoImportQualifier -> Bool)
-> Eq DotProtoImportQualifier
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DotProtoImportQualifier -> DotProtoImportQualifier -> Bool
== :: DotProtoImportQualifier -> DotProtoImportQualifier -> Bool
$c/= :: DotProtoImportQualifier -> DotProtoImportQualifier -> Bool
/= :: DotProtoImportQualifier -> DotProtoImportQualifier -> Bool
Eq, (forall x.
 DotProtoImportQualifier -> Rep DotProtoImportQualifier x)
-> (forall x.
    Rep DotProtoImportQualifier x -> DotProtoImportQualifier)
-> Generic DotProtoImportQualifier
forall x. Rep DotProtoImportQualifier x -> DotProtoImportQualifier
forall x. DotProtoImportQualifier -> Rep DotProtoImportQualifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. DotProtoImportQualifier -> Rep DotProtoImportQualifier x
from :: forall x. DotProtoImportQualifier -> Rep DotProtoImportQualifier x
$cto :: forall x. Rep DotProtoImportQualifier x -> DotProtoImportQualifier
to :: forall x. Rep DotProtoImportQualifier x -> DotProtoImportQualifier
Generic, Eq DotProtoImportQualifier
Eq DotProtoImportQualifier =>
(DotProtoImportQualifier -> DotProtoImportQualifier -> Ordering)
-> (DotProtoImportQualifier -> DotProtoImportQualifier -> Bool)
-> (DotProtoImportQualifier -> DotProtoImportQualifier -> Bool)
-> (DotProtoImportQualifier -> DotProtoImportQualifier -> Bool)
-> (DotProtoImportQualifier -> DotProtoImportQualifier -> Bool)
-> (DotProtoImportQualifier
    -> DotProtoImportQualifier -> DotProtoImportQualifier)
-> (DotProtoImportQualifier
    -> DotProtoImportQualifier -> DotProtoImportQualifier)
-> Ord DotProtoImportQualifier
DotProtoImportQualifier -> DotProtoImportQualifier -> Bool
DotProtoImportQualifier -> DotProtoImportQualifier -> Ordering
DotProtoImportQualifier
-> DotProtoImportQualifier -> DotProtoImportQualifier
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: DotProtoImportQualifier -> DotProtoImportQualifier -> Ordering
compare :: DotProtoImportQualifier -> DotProtoImportQualifier -> Ordering
$c< :: DotProtoImportQualifier -> DotProtoImportQualifier -> Bool
< :: DotProtoImportQualifier -> DotProtoImportQualifier -> Bool
$c<= :: DotProtoImportQualifier -> DotProtoImportQualifier -> Bool
<= :: DotProtoImportQualifier -> DotProtoImportQualifier -> Bool
$c> :: DotProtoImportQualifier -> DotProtoImportQualifier -> Bool
> :: DotProtoImportQualifier -> DotProtoImportQualifier -> Bool
$c>= :: DotProtoImportQualifier -> DotProtoImportQualifier -> Bool
>= :: DotProtoImportQualifier -> DotProtoImportQualifier -> Bool
$cmax :: DotProtoImportQualifier
-> DotProtoImportQualifier -> DotProtoImportQualifier
max :: DotProtoImportQualifier
-> DotProtoImportQualifier -> DotProtoImportQualifier
$cmin :: DotProtoImportQualifier
-> DotProtoImportQualifier -> DotProtoImportQualifier
min :: DotProtoImportQualifier
-> DotProtoImportQualifier -> DotProtoImportQualifier
Ord, Int -> DotProtoImportQualifier -> String -> String
[DotProtoImportQualifier] -> String -> String
DotProtoImportQualifier -> String
(Int -> DotProtoImportQualifier -> String -> String)
-> (DotProtoImportQualifier -> String)
-> ([DotProtoImportQualifier] -> String -> String)
-> Show DotProtoImportQualifier
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> DotProtoImportQualifier -> String -> String
showsPrec :: Int -> DotProtoImportQualifier -> String -> String
$cshow :: DotProtoImportQualifier -> String
show :: DotProtoImportQualifier -> String
$cshowList :: [DotProtoImportQualifier] -> String -> String
showList :: [DotProtoImportQualifier] -> String -> String
Show)

instance Pretty DotProtoImportQualifier where
  pPrint :: DotProtoImportQualifier -> Doc
pPrint DotProtoImportQualifier
DotProtoImportDefault = Doc
PP.empty
  pPrint DotProtoImportQualifier
DotProtoImportPublic  = String -> Doc
PP.text String
"public"
  pPrint DotProtoImportQualifier
DotProtoImportWeak    = String -> Doc
PP.text String
"weak"

instance Arbitrary DotProtoImportQualifier where
  arbitrary :: Gen DotProtoImportQualifier
arbitrary = [DotProtoImportQualifier] -> Gen DotProtoImportQualifier
forall a. HasCallStack => [a] -> Gen a
elements
    [ DotProtoImportQualifier
DotProtoImportDefault
    , DotProtoImportQualifier
DotProtoImportWeak
    , DotProtoImportQualifier
DotProtoImportPublic
    ]

-- | The namespace declaration
data DotProtoPackageSpec
  = DotProtoPackageSpec DotProtoIdentifier
  | DotProtoNoPackage
  deriving (Typeable DotProtoPackageSpec
Typeable DotProtoPackageSpec =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g)
 -> DotProtoPackageSpec
 -> c DotProtoPackageSpec)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c DotProtoPackageSpec)
-> (DotProtoPackageSpec -> Constr)
-> (DotProtoPackageSpec -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c DotProtoPackageSpec))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c DotProtoPackageSpec))
-> ((forall b. Data b => b -> b)
    -> DotProtoPackageSpec -> DotProtoPackageSpec)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoPackageSpec -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoPackageSpec -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> DotProtoPackageSpec -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> DotProtoPackageSpec -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> DotProtoPackageSpec -> m DotProtoPackageSpec)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> DotProtoPackageSpec -> m DotProtoPackageSpec)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> DotProtoPackageSpec -> m DotProtoPackageSpec)
-> Data DotProtoPackageSpec
DotProtoPackageSpec -> Constr
DotProtoPackageSpec -> DataType
(forall b. Data b => b -> b)
-> DotProtoPackageSpec -> DotProtoPackageSpec
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoPackageSpec -> u
forall u.
(forall d. Data d => d -> u) -> DotProtoPackageSpec -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoPackageSpec -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoPackageSpec -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoPackageSpec -> m DotProtoPackageSpec
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoPackageSpec -> m DotProtoPackageSpec
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoPackageSpec
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> DotProtoPackageSpec
-> c DotProtoPackageSpec
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoPackageSpec)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoPackageSpec)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> DotProtoPackageSpec
-> c DotProtoPackageSpec
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> DotProtoPackageSpec
-> c DotProtoPackageSpec
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoPackageSpec
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoPackageSpec
$ctoConstr :: DotProtoPackageSpec -> Constr
toConstr :: DotProtoPackageSpec -> Constr
$cdataTypeOf :: DotProtoPackageSpec -> DataType
dataTypeOf :: DotProtoPackageSpec -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoPackageSpec)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoPackageSpec)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoPackageSpec)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoPackageSpec)
$cgmapT :: (forall b. Data b => b -> b)
-> DotProtoPackageSpec -> DotProtoPackageSpec
gmapT :: (forall b. Data b => b -> b)
-> DotProtoPackageSpec -> DotProtoPackageSpec
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoPackageSpec -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoPackageSpec -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoPackageSpec -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoPackageSpec -> r
$cgmapQ :: forall u.
(forall d. Data d => d -> u) -> DotProtoPackageSpec -> [u]
gmapQ :: forall u.
(forall d. Data d => d -> u) -> DotProtoPackageSpec -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoPackageSpec -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoPackageSpec -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoPackageSpec -> m DotProtoPackageSpec
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoPackageSpec -> m DotProtoPackageSpec
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoPackageSpec -> m DotProtoPackageSpec
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoPackageSpec -> m DotProtoPackageSpec
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoPackageSpec -> m DotProtoPackageSpec
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoPackageSpec -> m DotProtoPackageSpec
Data, DotProtoPackageSpec -> DotProtoPackageSpec -> Bool
(DotProtoPackageSpec -> DotProtoPackageSpec -> Bool)
-> (DotProtoPackageSpec -> DotProtoPackageSpec -> Bool)
-> Eq DotProtoPackageSpec
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DotProtoPackageSpec -> DotProtoPackageSpec -> Bool
== :: DotProtoPackageSpec -> DotProtoPackageSpec -> Bool
$c/= :: DotProtoPackageSpec -> DotProtoPackageSpec -> Bool
/= :: DotProtoPackageSpec -> DotProtoPackageSpec -> Bool
Eq, (forall x. DotProtoPackageSpec -> Rep DotProtoPackageSpec x)
-> (forall x. Rep DotProtoPackageSpec x -> DotProtoPackageSpec)
-> Generic DotProtoPackageSpec
forall x. Rep DotProtoPackageSpec x -> DotProtoPackageSpec
forall x. DotProtoPackageSpec -> Rep DotProtoPackageSpec x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. DotProtoPackageSpec -> Rep DotProtoPackageSpec x
from :: forall x. DotProtoPackageSpec -> Rep DotProtoPackageSpec x
$cto :: forall x. Rep DotProtoPackageSpec x -> DotProtoPackageSpec
to :: forall x. Rep DotProtoPackageSpec x -> DotProtoPackageSpec
Generic, Eq DotProtoPackageSpec
Eq DotProtoPackageSpec =>
(DotProtoPackageSpec -> DotProtoPackageSpec -> Ordering)
-> (DotProtoPackageSpec -> DotProtoPackageSpec -> Bool)
-> (DotProtoPackageSpec -> DotProtoPackageSpec -> Bool)
-> (DotProtoPackageSpec -> DotProtoPackageSpec -> Bool)
-> (DotProtoPackageSpec -> DotProtoPackageSpec -> Bool)
-> (DotProtoPackageSpec
    -> DotProtoPackageSpec -> DotProtoPackageSpec)
-> (DotProtoPackageSpec
    -> DotProtoPackageSpec -> DotProtoPackageSpec)
-> Ord DotProtoPackageSpec
DotProtoPackageSpec -> DotProtoPackageSpec -> Bool
DotProtoPackageSpec -> DotProtoPackageSpec -> Ordering
DotProtoPackageSpec -> DotProtoPackageSpec -> DotProtoPackageSpec
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: DotProtoPackageSpec -> DotProtoPackageSpec -> Ordering
compare :: DotProtoPackageSpec -> DotProtoPackageSpec -> Ordering
$c< :: DotProtoPackageSpec -> DotProtoPackageSpec -> Bool
< :: DotProtoPackageSpec -> DotProtoPackageSpec -> Bool
$c<= :: DotProtoPackageSpec -> DotProtoPackageSpec -> Bool
<= :: DotProtoPackageSpec -> DotProtoPackageSpec -> Bool
$c> :: DotProtoPackageSpec -> DotProtoPackageSpec -> Bool
> :: DotProtoPackageSpec -> DotProtoPackageSpec -> Bool
$c>= :: DotProtoPackageSpec -> DotProtoPackageSpec -> Bool
>= :: DotProtoPackageSpec -> DotProtoPackageSpec -> Bool
$cmax :: DotProtoPackageSpec -> DotProtoPackageSpec -> DotProtoPackageSpec
max :: DotProtoPackageSpec -> DotProtoPackageSpec -> DotProtoPackageSpec
$cmin :: DotProtoPackageSpec -> DotProtoPackageSpec -> DotProtoPackageSpec
min :: DotProtoPackageSpec -> DotProtoPackageSpec -> DotProtoPackageSpec
Ord, Int -> DotProtoPackageSpec -> String -> String
[DotProtoPackageSpec] -> String -> String
DotProtoPackageSpec -> String
(Int -> DotProtoPackageSpec -> String -> String)
-> (DotProtoPackageSpec -> String)
-> ([DotProtoPackageSpec] -> String -> String)
-> Show DotProtoPackageSpec
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> DotProtoPackageSpec -> String -> String
showsPrec :: Int -> DotProtoPackageSpec -> String -> String
$cshow :: DotProtoPackageSpec -> String
show :: DotProtoPackageSpec -> String
$cshowList :: [DotProtoPackageSpec] -> String -> String
showList :: [DotProtoPackageSpec] -> String -> String
Show)

instance Pretty DotProtoPackageSpec where
  pPrint :: DotProtoPackageSpec -> Doc
pPrint (DotProtoPackageSpec DotProtoIdentifier
p) = String -> Doc
PP.text String
"package" Doc -> Doc -> Doc
<+> DotProtoIdentifier -> Doc
forall a. Pretty a => a -> Doc
pPrint DotProtoIdentifier
p Doc -> Doc -> Doc
PP.<> String -> Doc
PP.text String
";"
  pPrint (DotProtoPackageSpec
DotProtoNoPackage)     = Doc
PP.empty

instance Arbitrary DotProtoPackageSpec where
  arbitrary :: Gen DotProtoPackageSpec
arbitrary = [Gen DotProtoPackageSpec] -> Gen DotProtoPackageSpec
forall a. HasCallStack => [Gen a] -> Gen a
oneof
    [ DotProtoPackageSpec -> Gen DotProtoPackageSpec
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return DotProtoPackageSpec
DotProtoNoPackage
    , (DotProtoIdentifier -> DotProtoPackageSpec)
-> Gen DotProtoIdentifier -> Gen DotProtoPackageSpec
forall a b. (a -> b) -> Gen a -> Gen b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap DotProtoIdentifier -> DotProtoPackageSpec
DotProtoPackageSpec Gen DotProtoIdentifier
arbitrarySingleIdentifier
    , (DotProtoIdentifier -> DotProtoPackageSpec)
-> Gen DotProtoIdentifier -> Gen DotProtoPackageSpec
forall a b. (a -> b) -> Gen a -> Gen b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap DotProtoIdentifier -> DotProtoPackageSpec
DotProtoPackageSpec Gen DotProtoIdentifier
arbitraryPathIdentifier
    ]

-- | An option id/value pair, can be attached to many types of statements
data DotProtoOption = DotProtoOption
  { DotProtoOption -> DotProtoIdentifier
dotProtoOptionIdentifier :: DotProtoIdentifier
  , DotProtoOption -> DotProtoValue
dotProtoOptionValue      :: DotProtoValue
  } deriving (Typeable DotProtoOption
Typeable DotProtoOption =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> DotProtoOption -> c DotProtoOption)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c DotProtoOption)
-> (DotProtoOption -> Constr)
-> (DotProtoOption -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c DotProtoOption))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c DotProtoOption))
-> ((forall b. Data b => b -> b)
    -> DotProtoOption -> DotProtoOption)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoOption -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoOption -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> DotProtoOption -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> DotProtoOption -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> DotProtoOption -> m DotProtoOption)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> DotProtoOption -> m DotProtoOption)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> DotProtoOption -> m DotProtoOption)
-> Data DotProtoOption
DotProtoOption -> Constr
DotProtoOption -> DataType
(forall b. Data b => b -> b) -> DotProtoOption -> DotProtoOption
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoOption -> u
forall u. (forall d. Data d => d -> u) -> DotProtoOption -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoOption -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoOption -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoOption -> m DotProtoOption
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoOption -> m DotProtoOption
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoOption
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProtoOption -> c DotProtoOption
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoOption)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoOption)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProtoOption -> c DotProtoOption
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProtoOption -> c DotProtoOption
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoOption
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoOption
$ctoConstr :: DotProtoOption -> Constr
toConstr :: DotProtoOption -> Constr
$cdataTypeOf :: DotProtoOption -> DataType
dataTypeOf :: DotProtoOption -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoOption)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoOption)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoOption)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoOption)
$cgmapT :: (forall b. Data b => b -> b) -> DotProtoOption -> DotProtoOption
gmapT :: (forall b. Data b => b -> b) -> DotProtoOption -> DotProtoOption
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoOption -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoOption -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoOption -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoOption -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> DotProtoOption -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> DotProtoOption -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoOption -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoOption -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoOption -> m DotProtoOption
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoOption -> m DotProtoOption
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoOption -> m DotProtoOption
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoOption -> m DotProtoOption
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoOption -> m DotProtoOption
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoOption -> m DotProtoOption
Data, DotProtoOption -> DotProtoOption -> Bool
(DotProtoOption -> DotProtoOption -> Bool)
-> (DotProtoOption -> DotProtoOption -> Bool) -> Eq DotProtoOption
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DotProtoOption -> DotProtoOption -> Bool
== :: DotProtoOption -> DotProtoOption -> Bool
$c/= :: DotProtoOption -> DotProtoOption -> Bool
/= :: DotProtoOption -> DotProtoOption -> Bool
Eq, (forall x. DotProtoOption -> Rep DotProtoOption x)
-> (forall x. Rep DotProtoOption x -> DotProtoOption)
-> Generic DotProtoOption
forall x. Rep DotProtoOption x -> DotProtoOption
forall x. DotProtoOption -> Rep DotProtoOption x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. DotProtoOption -> Rep DotProtoOption x
from :: forall x. DotProtoOption -> Rep DotProtoOption x
$cto :: forall x. Rep DotProtoOption x -> DotProtoOption
to :: forall x. Rep DotProtoOption x -> DotProtoOption
Generic, Eq DotProtoOption
Eq DotProtoOption =>
(DotProtoOption -> DotProtoOption -> Ordering)
-> (DotProtoOption -> DotProtoOption -> Bool)
-> (DotProtoOption -> DotProtoOption -> Bool)
-> (DotProtoOption -> DotProtoOption -> Bool)
-> (DotProtoOption -> DotProtoOption -> Bool)
-> (DotProtoOption -> DotProtoOption -> DotProtoOption)
-> (DotProtoOption -> DotProtoOption -> DotProtoOption)
-> Ord DotProtoOption
DotProtoOption -> DotProtoOption -> Bool
DotProtoOption -> DotProtoOption -> Ordering
DotProtoOption -> DotProtoOption -> DotProtoOption
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: DotProtoOption -> DotProtoOption -> Ordering
compare :: DotProtoOption -> DotProtoOption -> Ordering
$c< :: DotProtoOption -> DotProtoOption -> Bool
< :: DotProtoOption -> DotProtoOption -> Bool
$c<= :: DotProtoOption -> DotProtoOption -> Bool
<= :: DotProtoOption -> DotProtoOption -> Bool
$c> :: DotProtoOption -> DotProtoOption -> Bool
> :: DotProtoOption -> DotProtoOption -> Bool
$c>= :: DotProtoOption -> DotProtoOption -> Bool
>= :: DotProtoOption -> DotProtoOption -> Bool
$cmax :: DotProtoOption -> DotProtoOption -> DotProtoOption
max :: DotProtoOption -> DotProtoOption -> DotProtoOption
$cmin :: DotProtoOption -> DotProtoOption -> DotProtoOption
min :: DotProtoOption -> DotProtoOption -> DotProtoOption
Ord, Int -> DotProtoOption -> String -> String
[DotProtoOption] -> String -> String
DotProtoOption -> String
(Int -> DotProtoOption -> String -> String)
-> (DotProtoOption -> String)
-> ([DotProtoOption] -> String -> String)
-> Show DotProtoOption
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> DotProtoOption -> String -> String
showsPrec :: Int -> DotProtoOption -> String -> String
$cshow :: DotProtoOption -> String
show :: DotProtoOption -> String
$cshowList :: [DotProtoOption] -> String -> String
showList :: [DotProtoOption] -> String -> String
Show)

instance Pretty DotProtoOption where
  pPrint :: DotProtoOption -> Doc
pPrint (DotProtoOption DotProtoIdentifier
key DotProtoValue
value) = DotProtoIdentifier -> Doc
forall a. Pretty a => a -> Doc
pPrint DotProtoIdentifier
key Doc -> Doc -> Doc
<+> String -> Doc
PP.text String
"=" Doc -> Doc -> Doc
<+> DotProtoValue -> Doc
forall a. Pretty a => a -> Doc
pPrint DotProtoValue
value

instance Arbitrary DotProtoOption where
    arbitrary :: Gen DotProtoOption
arbitrary = do
      DotProtoIdentifier
dotProtoOptionIdentifier <- [Gen DotProtoIdentifier] -> Gen DotProtoIdentifier
forall a. HasCallStack => [Gen a] -> Gen a
oneof
        [ Gen DotProtoIdentifier
arbitraryPathIdentifier
        , Gen DotProtoIdentifier
arbitraryNestedIdentifier
        ]
      DotProtoValue
dotProtoOptionValue <- Gen DotProtoValue
forall a. Arbitrary a => Gen a
arbitrary
      DotProtoOption -> Gen DotProtoOption
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return (DotProtoOption {DotProtoValue
DotProtoIdentifier
dotProtoOptionIdentifier :: DotProtoIdentifier
dotProtoOptionValue :: DotProtoValue
dotProtoOptionIdentifier :: DotProtoIdentifier
dotProtoOptionValue :: DotProtoValue
..})

-- | Top-level protocol definitions
data DotProtoDefinition
  = DotProtoMessage String DotProtoIdentifier [DotProtoMessagePart]
  | DotProtoEnum    String DotProtoIdentifier [DotProtoEnumPart]
  | DotProtoService String DotProtoIdentifier [DotProtoServicePart]
  deriving (Typeable DotProtoDefinition
Typeable DotProtoDefinition =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g)
 -> DotProtoDefinition
 -> c DotProtoDefinition)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c DotProtoDefinition)
-> (DotProtoDefinition -> Constr)
-> (DotProtoDefinition -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c DotProtoDefinition))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c DotProtoDefinition))
-> ((forall b. Data b => b -> b)
    -> DotProtoDefinition -> DotProtoDefinition)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoDefinition -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoDefinition -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> DotProtoDefinition -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> DotProtoDefinition -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> DotProtoDefinition -> m DotProtoDefinition)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> DotProtoDefinition -> m DotProtoDefinition)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> DotProtoDefinition -> m DotProtoDefinition)
-> Data DotProtoDefinition
DotProtoDefinition -> Constr
DotProtoDefinition -> DataType
(forall b. Data b => b -> b)
-> DotProtoDefinition -> DotProtoDefinition
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoDefinition -> u
forall u. (forall d. Data d => d -> u) -> DotProtoDefinition -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoDefinition -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoDefinition -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoDefinition -> m DotProtoDefinition
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoDefinition -> m DotProtoDefinition
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoDefinition
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> DotProtoDefinition
-> c DotProtoDefinition
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoDefinition)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoDefinition)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> DotProtoDefinition
-> c DotProtoDefinition
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> DotProtoDefinition
-> c DotProtoDefinition
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoDefinition
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoDefinition
$ctoConstr :: DotProtoDefinition -> Constr
toConstr :: DotProtoDefinition -> Constr
$cdataTypeOf :: DotProtoDefinition -> DataType
dataTypeOf :: DotProtoDefinition -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoDefinition)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoDefinition)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoDefinition)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoDefinition)
$cgmapT :: (forall b. Data b => b -> b)
-> DotProtoDefinition -> DotProtoDefinition
gmapT :: (forall b. Data b => b -> b)
-> DotProtoDefinition -> DotProtoDefinition
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoDefinition -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoDefinition -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoDefinition -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoDefinition -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> DotProtoDefinition -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> DotProtoDefinition -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoDefinition -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoDefinition -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoDefinition -> m DotProtoDefinition
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoDefinition -> m DotProtoDefinition
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoDefinition -> m DotProtoDefinition
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoDefinition -> m DotProtoDefinition
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoDefinition -> m DotProtoDefinition
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoDefinition -> m DotProtoDefinition
Data, DotProtoDefinition -> DotProtoDefinition -> Bool
(DotProtoDefinition -> DotProtoDefinition -> Bool)
-> (DotProtoDefinition -> DotProtoDefinition -> Bool)
-> Eq DotProtoDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DotProtoDefinition -> DotProtoDefinition -> Bool
== :: DotProtoDefinition -> DotProtoDefinition -> Bool
$c/= :: DotProtoDefinition -> DotProtoDefinition -> Bool
/= :: DotProtoDefinition -> DotProtoDefinition -> Bool
Eq, (forall x. DotProtoDefinition -> Rep DotProtoDefinition x)
-> (forall x. Rep DotProtoDefinition x -> DotProtoDefinition)
-> Generic DotProtoDefinition
forall x. Rep DotProtoDefinition x -> DotProtoDefinition
forall x. DotProtoDefinition -> Rep DotProtoDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. DotProtoDefinition -> Rep DotProtoDefinition x
from :: forall x. DotProtoDefinition -> Rep DotProtoDefinition x
$cto :: forall x. Rep DotProtoDefinition x -> DotProtoDefinition
to :: forall x. Rep DotProtoDefinition x -> DotProtoDefinition
Generic, Eq DotProtoDefinition
Eq DotProtoDefinition =>
(DotProtoDefinition -> DotProtoDefinition -> Ordering)
-> (DotProtoDefinition -> DotProtoDefinition -> Bool)
-> (DotProtoDefinition -> DotProtoDefinition -> Bool)
-> (DotProtoDefinition -> DotProtoDefinition -> Bool)
-> (DotProtoDefinition -> DotProtoDefinition -> Bool)
-> (DotProtoDefinition -> DotProtoDefinition -> DotProtoDefinition)
-> (DotProtoDefinition -> DotProtoDefinition -> DotProtoDefinition)
-> Ord DotProtoDefinition
DotProtoDefinition -> DotProtoDefinition -> Bool
DotProtoDefinition -> DotProtoDefinition -> Ordering
DotProtoDefinition -> DotProtoDefinition -> DotProtoDefinition
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: DotProtoDefinition -> DotProtoDefinition -> Ordering
compare :: DotProtoDefinition -> DotProtoDefinition -> Ordering
$c< :: DotProtoDefinition -> DotProtoDefinition -> Bool
< :: DotProtoDefinition -> DotProtoDefinition -> Bool
$c<= :: DotProtoDefinition -> DotProtoDefinition -> Bool
<= :: DotProtoDefinition -> DotProtoDefinition -> Bool
$c> :: DotProtoDefinition -> DotProtoDefinition -> Bool
> :: DotProtoDefinition -> DotProtoDefinition -> Bool
$c>= :: DotProtoDefinition -> DotProtoDefinition -> Bool
>= :: DotProtoDefinition -> DotProtoDefinition -> Bool
$cmax :: DotProtoDefinition -> DotProtoDefinition -> DotProtoDefinition
max :: DotProtoDefinition -> DotProtoDefinition -> DotProtoDefinition
$cmin :: DotProtoDefinition -> DotProtoDefinition -> DotProtoDefinition
min :: DotProtoDefinition -> DotProtoDefinition -> DotProtoDefinition
Ord, Int -> DotProtoDefinition -> String -> String
[DotProtoDefinition] -> String -> String
DotProtoDefinition -> String
(Int -> DotProtoDefinition -> String -> String)
-> (DotProtoDefinition -> String)
-> ([DotProtoDefinition] -> String -> String)
-> Show DotProtoDefinition
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> DotProtoDefinition -> String -> String
showsPrec :: Int -> DotProtoDefinition -> String -> String
$cshow :: DotProtoDefinition -> String
show :: DotProtoDefinition -> String
$cshowList :: [DotProtoDefinition] -> String -> String
showList :: [DotProtoDefinition] -> String -> String
Show)

instance Arbitrary DotProtoDefinition where
  arbitrary :: Gen DotProtoDefinition
arbitrary = [Gen DotProtoDefinition] -> Gen DotProtoDefinition
forall a. HasCallStack => [Gen a] -> Gen a
oneof [Gen DotProtoDefinition
arbitraryMessage, Gen DotProtoDefinition
arbitraryEnum]
    where
      arbitraryMessage :: Gen DotProtoDefinition
arbitraryMessage = do
        String
comment    <- String -> Gen String
forall a. a -> Gen a
forall (f :: * -> *) a. Applicative f => a -> f a
pure String
forall a. Monoid a => a
mempty  -- until parser supports comments
        DotProtoIdentifier
identifier <- Gen DotProtoIdentifier
arbitrarySingleIdentifier
        [DotProtoMessagePart]
parts      <- Gen DotProtoMessagePart -> Gen [DotProtoMessagePart]
forall a. Gen a -> Gen [a]
smallListOf Gen DotProtoMessagePart
forall a. Arbitrary a => Gen a
arbitrary
        DotProtoDefinition -> Gen DotProtoDefinition
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return (String
-> DotProtoIdentifier
-> [DotProtoMessagePart]
-> DotProtoDefinition
DotProtoMessage String
comment DotProtoIdentifier
identifier [DotProtoMessagePart]
parts)

      arbitraryEnum :: Gen DotProtoDefinition
arbitraryEnum = do
        String
comment    <- String -> Gen String
forall a. a -> Gen a
forall (f :: * -> *) a. Applicative f => a -> f a
pure String
forall a. Monoid a => a
mempty  -- until parser supports comments
        DotProtoIdentifier
identifier <- Gen DotProtoIdentifier
arbitrarySingleIdentifier
        [DotProtoEnumPart]
parts      <- Gen DotProtoEnumPart -> Gen [DotProtoEnumPart]
forall a. Gen a -> Gen [a]
smallListOf Gen DotProtoEnumPart
forall a. Arbitrary a => Gen a
arbitrary
        DotProtoDefinition -> Gen DotProtoDefinition
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return (String
-> DotProtoIdentifier -> [DotProtoEnumPart] -> DotProtoDefinition
DotProtoEnum String
comment DotProtoIdentifier
identifier [DotProtoEnumPart]
parts)

-- | Tracks misc metadata about the AST
data DotProtoMeta = DotProtoMeta
  { DotProtoMeta -> Path
metaModulePath :: Path
    -- ^ The "module path" associated with the .proto file from which this AST
    -- was parsed. The "module path" is derived from the `--includeDir`-relative
    -- .proto filename passed to `Proto3.Suite.DotProto.Parsing.parseProtoFile`. See
    -- 'Proto3.Suite.DotProto.Internal.toModulePath' for details on how module
    -- path values are constructed. See
    -- 'Proto3.Suite.DotProto.Generate.modulePathModName' to see how it is used
    -- during code generation.
  } deriving (Typeable DotProtoMeta
Typeable DotProtoMeta =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> DotProtoMeta -> c DotProtoMeta)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c DotProtoMeta)
-> (DotProtoMeta -> Constr)
-> (DotProtoMeta -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c DotProtoMeta))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c DotProtoMeta))
-> ((forall b. Data b => b -> b) -> DotProtoMeta -> DotProtoMeta)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoMeta -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoMeta -> r)
-> (forall u. (forall d. Data d => d -> u) -> DotProtoMeta -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> DotProtoMeta -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> DotProtoMeta -> m DotProtoMeta)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> DotProtoMeta -> m DotProtoMeta)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> DotProtoMeta -> m DotProtoMeta)
-> Data DotProtoMeta
DotProtoMeta -> Constr
DotProtoMeta -> DataType
(forall b. Data b => b -> b) -> DotProtoMeta -> DotProtoMeta
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> DotProtoMeta -> u
forall u. (forall d. Data d => d -> u) -> DotProtoMeta -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoMeta -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoMeta -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DotProtoMeta -> m DotProtoMeta
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DotProtoMeta -> m DotProtoMeta
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoMeta
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProtoMeta -> c DotProtoMeta
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoMeta)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoMeta)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProtoMeta -> c DotProtoMeta
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProtoMeta -> c DotProtoMeta
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoMeta
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoMeta
$ctoConstr :: DotProtoMeta -> Constr
toConstr :: DotProtoMeta -> Constr
$cdataTypeOf :: DotProtoMeta -> DataType
dataTypeOf :: DotProtoMeta -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoMeta)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoMeta)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoMeta)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoMeta)
$cgmapT :: (forall b. Data b => b -> b) -> DotProtoMeta -> DotProtoMeta
gmapT :: (forall b. Data b => b -> b) -> DotProtoMeta -> DotProtoMeta
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoMeta -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoMeta -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoMeta -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoMeta -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> DotProtoMeta -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> DotProtoMeta -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> DotProtoMeta -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> DotProtoMeta -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DotProtoMeta -> m DotProtoMeta
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DotProtoMeta -> m DotProtoMeta
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DotProtoMeta -> m DotProtoMeta
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DotProtoMeta -> m DotProtoMeta
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DotProtoMeta -> m DotProtoMeta
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DotProtoMeta -> m DotProtoMeta
Data, DotProtoMeta -> DotProtoMeta -> Bool
(DotProtoMeta -> DotProtoMeta -> Bool)
-> (DotProtoMeta -> DotProtoMeta -> Bool) -> Eq DotProtoMeta
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DotProtoMeta -> DotProtoMeta -> Bool
== :: DotProtoMeta -> DotProtoMeta -> Bool
$c/= :: DotProtoMeta -> DotProtoMeta -> Bool
/= :: DotProtoMeta -> DotProtoMeta -> Bool
Eq, (forall x. DotProtoMeta -> Rep DotProtoMeta x)
-> (forall x. Rep DotProtoMeta x -> DotProtoMeta)
-> Generic DotProtoMeta
forall x. Rep DotProtoMeta x -> DotProtoMeta
forall x. DotProtoMeta -> Rep DotProtoMeta x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. DotProtoMeta -> Rep DotProtoMeta x
from :: forall x. DotProtoMeta -> Rep DotProtoMeta x
$cto :: forall x. Rep DotProtoMeta x -> DotProtoMeta
to :: forall x. Rep DotProtoMeta x -> DotProtoMeta
Generic, Eq DotProtoMeta
Eq DotProtoMeta =>
(DotProtoMeta -> DotProtoMeta -> Ordering)
-> (DotProtoMeta -> DotProtoMeta -> Bool)
-> (DotProtoMeta -> DotProtoMeta -> Bool)
-> (DotProtoMeta -> DotProtoMeta -> Bool)
-> (DotProtoMeta -> DotProtoMeta -> Bool)
-> (DotProtoMeta -> DotProtoMeta -> DotProtoMeta)
-> (DotProtoMeta -> DotProtoMeta -> DotProtoMeta)
-> Ord DotProtoMeta
DotProtoMeta -> DotProtoMeta -> Bool
DotProtoMeta -> DotProtoMeta -> Ordering
DotProtoMeta -> DotProtoMeta -> DotProtoMeta
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: DotProtoMeta -> DotProtoMeta -> Ordering
compare :: DotProtoMeta -> DotProtoMeta -> Ordering
$c< :: DotProtoMeta -> DotProtoMeta -> Bool
< :: DotProtoMeta -> DotProtoMeta -> Bool
$c<= :: DotProtoMeta -> DotProtoMeta -> Bool
<= :: DotProtoMeta -> DotProtoMeta -> Bool
$c> :: DotProtoMeta -> DotProtoMeta -> Bool
> :: DotProtoMeta -> DotProtoMeta -> Bool
$c>= :: DotProtoMeta -> DotProtoMeta -> Bool
>= :: DotProtoMeta -> DotProtoMeta -> Bool
$cmax :: DotProtoMeta -> DotProtoMeta -> DotProtoMeta
max :: DotProtoMeta -> DotProtoMeta -> DotProtoMeta
$cmin :: DotProtoMeta -> DotProtoMeta -> DotProtoMeta
min :: DotProtoMeta -> DotProtoMeta -> DotProtoMeta
Ord, Int -> DotProtoMeta -> String -> String
[DotProtoMeta] -> String -> String
DotProtoMeta -> String
(Int -> DotProtoMeta -> String -> String)
-> (DotProtoMeta -> String)
-> ([DotProtoMeta] -> String -> String)
-> Show DotProtoMeta
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> DotProtoMeta -> String -> String
showsPrec :: Int -> DotProtoMeta -> String -> String
$cshow :: DotProtoMeta -> String
show :: DotProtoMeta -> String
$cshowList :: [DotProtoMeta] -> String -> String
showList :: [DotProtoMeta] -> String -> String
Show)

instance Arbitrary DotProtoMeta where
  arbitrary :: Gen DotProtoMeta
arbitrary = DotProtoMeta -> Gen DotProtoMeta
forall a. a -> Gen a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Path -> DotProtoMeta
DotProtoMeta Path
fakePath)

-- | This data structure represents a .proto file
--   The actual source order of protobuf statements isn't meaningful so
--   statements are sorted by type during parsing.
--   A .proto file with more than one package declaration is considered invalid.
data DotProto = DotProto
  { DotProto -> [DotProtoImport]
protoImports     :: [DotProtoImport]
  , DotProto -> [DotProtoOption]
protoOptions     :: [DotProtoOption]
  , DotProto -> DotProtoPackageSpec
protoPackage     :: DotProtoPackageSpec
  , DotProto -> [DotProtoDefinition]
protoDefinitions :: [DotProtoDefinition]
  , DotProto -> DotProtoMeta
protoMeta        :: DotProtoMeta
  } deriving (Typeable DotProto
Typeable DotProto =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> DotProto -> c DotProto)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c DotProto)
-> (DotProto -> Constr)
-> (DotProto -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c DotProto))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DotProto))
-> ((forall b. Data b => b -> b) -> DotProto -> DotProto)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProto -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProto -> r)
-> (forall u. (forall d. Data d => d -> u) -> DotProto -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> DotProto -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> DotProto -> m DotProto)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> DotProto -> m DotProto)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> DotProto -> m DotProto)
-> Data DotProto
DotProto -> Constr
DotProto -> DataType
(forall b. Data b => b -> b) -> DotProto -> DotProto
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> DotProto -> u
forall u. (forall d. Data d => d -> u) -> DotProto -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProto -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProto -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DotProto -> m DotProto
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DotProto -> m DotProto
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProto
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProto -> c DotProto
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProto)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DotProto)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProto -> c DotProto
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProto -> c DotProto
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProto
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProto
$ctoConstr :: DotProto -> Constr
toConstr :: DotProto -> Constr
$cdataTypeOf :: DotProto -> DataType
dataTypeOf :: DotProto -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProto)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProto)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DotProto)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DotProto)
$cgmapT :: (forall b. Data b => b -> b) -> DotProto -> DotProto
gmapT :: (forall b. Data b => b -> b) -> DotProto -> DotProto
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProto -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProto -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProto -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProto -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> DotProto -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> DotProto -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> DotProto -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> DotProto -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DotProto -> m DotProto
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DotProto -> m DotProto
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DotProto -> m DotProto
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DotProto -> m DotProto
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DotProto -> m DotProto
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DotProto -> m DotProto
Data, DotProto -> DotProto -> Bool
(DotProto -> DotProto -> Bool)
-> (DotProto -> DotProto -> Bool) -> Eq DotProto
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DotProto -> DotProto -> Bool
== :: DotProto -> DotProto -> Bool
$c/= :: DotProto -> DotProto -> Bool
/= :: DotProto -> DotProto -> Bool
Eq, (forall x. DotProto -> Rep DotProto x)
-> (forall x. Rep DotProto x -> DotProto) -> Generic DotProto
forall x. Rep DotProto x -> DotProto
forall x. DotProto -> Rep DotProto x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. DotProto -> Rep DotProto x
from :: forall x. DotProto -> Rep DotProto x
$cto :: forall x. Rep DotProto x -> DotProto
to :: forall x. Rep DotProto x -> DotProto
Generic, Eq DotProto
Eq DotProto =>
(DotProto -> DotProto -> Ordering)
-> (DotProto -> DotProto -> Bool)
-> (DotProto -> DotProto -> Bool)
-> (DotProto -> DotProto -> Bool)
-> (DotProto -> DotProto -> Bool)
-> (DotProto -> DotProto -> DotProto)
-> (DotProto -> DotProto -> DotProto)
-> Ord DotProto
DotProto -> DotProto -> Bool
DotProto -> DotProto -> Ordering
DotProto -> DotProto -> DotProto
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: DotProto -> DotProto -> Ordering
compare :: DotProto -> DotProto -> Ordering
$c< :: DotProto -> DotProto -> Bool
< :: DotProto -> DotProto -> Bool
$c<= :: DotProto -> DotProto -> Bool
<= :: DotProto -> DotProto -> Bool
$c> :: DotProto -> DotProto -> Bool
> :: DotProto -> DotProto -> Bool
$c>= :: DotProto -> DotProto -> Bool
>= :: DotProto -> DotProto -> Bool
$cmax :: DotProto -> DotProto -> DotProto
max :: DotProto -> DotProto -> DotProto
$cmin :: DotProto -> DotProto -> DotProto
min :: DotProto -> DotProto -> DotProto
Ord, Int -> DotProto -> String -> String
[DotProto] -> String -> String
DotProto -> String
(Int -> DotProto -> String -> String)
-> (DotProto -> String)
-> ([DotProto] -> String -> String)
-> Show DotProto
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> DotProto -> String -> String
showsPrec :: Int -> DotProto -> String -> String
$cshow :: DotProto -> String
show :: DotProto -> String
$cshowList :: [DotProto] -> String -> String
showList :: [DotProto] -> String -> String
Show)

instance Arbitrary DotProto where
  arbitrary :: Gen DotProto
arbitrary = do
    [DotProtoImport]
protoImports     <- Gen DotProtoImport -> Gen [DotProtoImport]
forall a. Gen a -> Gen [a]
smallListOf Gen DotProtoImport
forall a. Arbitrary a => Gen a
arbitrary
    [DotProtoOption]
protoOptions     <- Gen DotProtoOption -> Gen [DotProtoOption]
forall a. Gen a -> Gen [a]
smallListOf Gen DotProtoOption
forall a. Arbitrary a => Gen a
arbitrary
    DotProtoPackageSpec
protoPackage     <- Gen DotProtoPackageSpec
forall a. Arbitrary a => Gen a
arbitrary
    [DotProtoDefinition]
protoDefinitions <- Gen DotProtoDefinition -> Gen [DotProtoDefinition]
forall a. Gen a -> Gen [a]
smallListOf Gen DotProtoDefinition
forall a. Arbitrary a => Gen a
arbitrary
    DotProtoMeta
protoMeta        <- Gen DotProtoMeta
forall a. Arbitrary a => Gen a
arbitrary
    DotProto -> Gen DotProto
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return (DotProto {[DotProtoDefinition]
[DotProtoOption]
[DotProtoImport]
DotProtoMeta
DotProtoPackageSpec
protoImports :: [DotProtoImport]
protoOptions :: [DotProtoOption]
protoPackage :: DotProtoPackageSpec
protoDefinitions :: [DotProtoDefinition]
protoMeta :: DotProtoMeta
protoImports :: [DotProtoImport]
protoOptions :: [DotProtoOption]
protoPackage :: DotProtoPackageSpec
protoDefinitions :: [DotProtoDefinition]
protoMeta :: DotProtoMeta
..})

-- | Matches the definition of @constant@ in the proto3 language spec
--   These are only used as rvalues
data DotProtoValue
  = Identifier DotProtoIdentifier
  | StringLit  String
  | IntLit     Int
  | FloatLit   Double
  | BoolLit    Bool
  deriving (Typeable DotProtoValue
Typeable DotProtoValue =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> DotProtoValue -> c DotProtoValue)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c DotProtoValue)
-> (DotProtoValue -> Constr)
-> (DotProtoValue -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c DotProtoValue))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c DotProtoValue))
-> ((forall b. Data b => b -> b) -> DotProtoValue -> DotProtoValue)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoValue -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoValue -> r)
-> (forall u. (forall d. Data d => d -> u) -> DotProtoValue -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> DotProtoValue -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> DotProtoValue -> m DotProtoValue)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> DotProtoValue -> m DotProtoValue)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> DotProtoValue -> m DotProtoValue)
-> Data DotProtoValue
DotProtoValue -> Constr
DotProtoValue -> DataType
(forall b. Data b => b -> b) -> DotProtoValue -> DotProtoValue
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> DotProtoValue -> u
forall u. (forall d. Data d => d -> u) -> DotProtoValue -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoValue -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoValue -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DotProtoValue -> m DotProtoValue
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DotProtoValue -> m DotProtoValue
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoValue
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProtoValue -> c DotProtoValue
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoValue)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoValue)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProtoValue -> c DotProtoValue
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProtoValue -> c DotProtoValue
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoValue
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoValue
$ctoConstr :: DotProtoValue -> Constr
toConstr :: DotProtoValue -> Constr
$cdataTypeOf :: DotProtoValue -> DataType
dataTypeOf :: DotProtoValue -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoValue)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoValue)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoValue)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoValue)
$cgmapT :: (forall b. Data b => b -> b) -> DotProtoValue -> DotProtoValue
gmapT :: (forall b. Data b => b -> b) -> DotProtoValue -> DotProtoValue
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoValue -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoValue -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoValue -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoValue -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> DotProtoValue -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> DotProtoValue -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> DotProtoValue -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> DotProtoValue -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DotProtoValue -> m DotProtoValue
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DotProtoValue -> m DotProtoValue
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DotProtoValue -> m DotProtoValue
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DotProtoValue -> m DotProtoValue
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DotProtoValue -> m DotProtoValue
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DotProtoValue -> m DotProtoValue
Data, DotProtoValue -> DotProtoValue -> Bool
(DotProtoValue -> DotProtoValue -> Bool)
-> (DotProtoValue -> DotProtoValue -> Bool) -> Eq DotProtoValue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DotProtoValue -> DotProtoValue -> Bool
== :: DotProtoValue -> DotProtoValue -> Bool
$c/= :: DotProtoValue -> DotProtoValue -> Bool
/= :: DotProtoValue -> DotProtoValue -> Bool
Eq, (forall x. DotProtoValue -> Rep DotProtoValue x)
-> (forall x. Rep DotProtoValue x -> DotProtoValue)
-> Generic DotProtoValue
forall x. Rep DotProtoValue x -> DotProtoValue
forall x. DotProtoValue -> Rep DotProtoValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. DotProtoValue -> Rep DotProtoValue x
from :: forall x. DotProtoValue -> Rep DotProtoValue x
$cto :: forall x. Rep DotProtoValue x -> DotProtoValue
to :: forall x. Rep DotProtoValue x -> DotProtoValue
Generic, Eq DotProtoValue
Eq DotProtoValue =>
(DotProtoValue -> DotProtoValue -> Ordering)
-> (DotProtoValue -> DotProtoValue -> Bool)
-> (DotProtoValue -> DotProtoValue -> Bool)
-> (DotProtoValue -> DotProtoValue -> Bool)
-> (DotProtoValue -> DotProtoValue -> Bool)
-> (DotProtoValue -> DotProtoValue -> DotProtoValue)
-> (DotProtoValue -> DotProtoValue -> DotProtoValue)
-> Ord DotProtoValue
DotProtoValue -> DotProtoValue -> Bool
DotProtoValue -> DotProtoValue -> Ordering
DotProtoValue -> DotProtoValue -> DotProtoValue
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: DotProtoValue -> DotProtoValue -> Ordering
compare :: DotProtoValue -> DotProtoValue -> Ordering
$c< :: DotProtoValue -> DotProtoValue -> Bool
< :: DotProtoValue -> DotProtoValue -> Bool
$c<= :: DotProtoValue -> DotProtoValue -> Bool
<= :: DotProtoValue -> DotProtoValue -> Bool
$c> :: DotProtoValue -> DotProtoValue -> Bool
> :: DotProtoValue -> DotProtoValue -> Bool
$c>= :: DotProtoValue -> DotProtoValue -> Bool
>= :: DotProtoValue -> DotProtoValue -> Bool
$cmax :: DotProtoValue -> DotProtoValue -> DotProtoValue
max :: DotProtoValue -> DotProtoValue -> DotProtoValue
$cmin :: DotProtoValue -> DotProtoValue -> DotProtoValue
min :: DotProtoValue -> DotProtoValue -> DotProtoValue
Ord, Int -> DotProtoValue -> String -> String
[DotProtoValue] -> String -> String
DotProtoValue -> String
(Int -> DotProtoValue -> String -> String)
-> (DotProtoValue -> String)
-> ([DotProtoValue] -> String -> String)
-> Show DotProtoValue
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> DotProtoValue -> String -> String
showsPrec :: Int -> DotProtoValue -> String -> String
$cshow :: DotProtoValue -> String
show :: DotProtoValue -> String
$cshowList :: [DotProtoValue] -> String -> String
showList :: [DotProtoValue] -> String -> String
Show)

instance Pretty DotProtoValue where
  pPrint :: DotProtoValue -> Doc
pPrint (Identifier DotProtoIdentifier
value) = DotProtoIdentifier -> Doc
forall a. Pretty a => a -> Doc
pPrint DotProtoIdentifier
value
  pPrint (StringLit  String
value) = String -> Doc
strLit String
value
  pPrint (IntLit     Int
value) = String -> Doc
PP.text (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ Int -> String
forall a. Show a => a -> String
show Int
value
  pPrint (FloatLit   Double
value) = String -> Doc
PP.text (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ Double -> String
forall a. Show a => a -> String
show Double
value
  pPrint (BoolLit    Bool
value) = String -> Doc
PP.text (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ Char -> Char
toLower (Char -> Char) -> String -> String
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Bool -> String
forall a. Show a => a -> String
show Bool
value

instance Arbitrary DotProtoValue where
  arbitrary :: Gen DotProtoValue
arbitrary = [Gen DotProtoValue] -> Gen DotProtoValue
forall a. HasCallStack => [Gen a] -> Gen a
oneof
    [ (DotProtoIdentifier -> DotProtoValue)
-> Gen DotProtoIdentifier -> Gen DotProtoValue
forall a b. (a -> b) -> Gen a -> Gen b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap DotProtoIdentifier -> DotProtoValue
Identifier  Gen DotProtoIdentifier
arbitrarySingleIdentifier
    , (String -> DotProtoValue) -> Gen String -> Gen DotProtoValue
forall a b. (a -> b) -> Gen a -> Gen b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> DotProtoValue
StringLit  (String -> Gen String
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return String
"")
    , (Int -> DotProtoValue) -> Gen Int -> Gen DotProtoValue
forall a b. (a -> b) -> Gen a -> Gen b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Int -> DotProtoValue
IntLit      Gen Int
forall a. Arbitrary a => Gen a
arbitrary
    , (Double -> DotProtoValue) -> Gen Double -> Gen DotProtoValue
forall a b. (a -> b) -> Gen a -> Gen b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Double -> DotProtoValue
FloatLit    Gen Double
forall a. Arbitrary a => Gen a
arbitrary
    , (Bool -> DotProtoValue) -> Gen Bool -> Gen DotProtoValue
forall a b. (a -> b) -> Gen a -> Gen b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Bool -> DotProtoValue
BoolLit     Gen Bool
forall a. Arbitrary a => Gen a
arbitrary
    ]

data DotProtoPrimType
  = Int32
  | Int64
  | SInt32
  | SInt64
  | UInt32
  | UInt64
  | Fixed32
  | Fixed64
  | SFixed32
  | SFixed64
  | String
  | Bytes
  | Bool
  | Float
  | Double
  | Named DotProtoIdentifier
  -- ^ A named type, referring to another message or enum defined in the same file
  deriving (Typeable DotProtoPrimType
Typeable DotProtoPrimType =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> DotProtoPrimType -> c DotProtoPrimType)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c DotProtoPrimType)
-> (DotProtoPrimType -> Constr)
-> (DotProtoPrimType -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c DotProtoPrimType))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c DotProtoPrimType))
-> ((forall b. Data b => b -> b)
    -> DotProtoPrimType -> DotProtoPrimType)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoPrimType -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoPrimType -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> DotProtoPrimType -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> DotProtoPrimType -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> DotProtoPrimType -> m DotProtoPrimType)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> DotProtoPrimType -> m DotProtoPrimType)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> DotProtoPrimType -> m DotProtoPrimType)
-> Data DotProtoPrimType
DotProtoPrimType -> Constr
DotProtoPrimType -> DataType
(forall b. Data b => b -> b)
-> DotProtoPrimType -> DotProtoPrimType
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoPrimType -> u
forall u. (forall d. Data d => d -> u) -> DotProtoPrimType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoPrimType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoPrimType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoPrimType -> m DotProtoPrimType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoPrimType -> m DotProtoPrimType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoPrimType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProtoPrimType -> c DotProtoPrimType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoPrimType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoPrimType)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProtoPrimType -> c DotProtoPrimType
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProtoPrimType -> c DotProtoPrimType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoPrimType
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoPrimType
$ctoConstr :: DotProtoPrimType -> Constr
toConstr :: DotProtoPrimType -> Constr
$cdataTypeOf :: DotProtoPrimType -> DataType
dataTypeOf :: DotProtoPrimType -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoPrimType)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoPrimType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoPrimType)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoPrimType)
$cgmapT :: (forall b. Data b => b -> b)
-> DotProtoPrimType -> DotProtoPrimType
gmapT :: (forall b. Data b => b -> b)
-> DotProtoPrimType -> DotProtoPrimType
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoPrimType -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoPrimType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoPrimType -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoPrimType -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> DotProtoPrimType -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> DotProtoPrimType -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoPrimType -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoPrimType -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoPrimType -> m DotProtoPrimType
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoPrimType -> m DotProtoPrimType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoPrimType -> m DotProtoPrimType
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoPrimType -> m DotProtoPrimType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoPrimType -> m DotProtoPrimType
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoPrimType -> m DotProtoPrimType
Data, DotProtoPrimType -> DotProtoPrimType -> Bool
(DotProtoPrimType -> DotProtoPrimType -> Bool)
-> (DotProtoPrimType -> DotProtoPrimType -> Bool)
-> Eq DotProtoPrimType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DotProtoPrimType -> DotProtoPrimType -> Bool
== :: DotProtoPrimType -> DotProtoPrimType -> Bool
$c/= :: DotProtoPrimType -> DotProtoPrimType -> Bool
/= :: DotProtoPrimType -> DotProtoPrimType -> Bool
Eq, (forall x. DotProtoPrimType -> Rep DotProtoPrimType x)
-> (forall x. Rep DotProtoPrimType x -> DotProtoPrimType)
-> Generic DotProtoPrimType
forall x. Rep DotProtoPrimType x -> DotProtoPrimType
forall x. DotProtoPrimType -> Rep DotProtoPrimType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. DotProtoPrimType -> Rep DotProtoPrimType x
from :: forall x. DotProtoPrimType -> Rep DotProtoPrimType x
$cto :: forall x. Rep DotProtoPrimType x -> DotProtoPrimType
to :: forall x. Rep DotProtoPrimType x -> DotProtoPrimType
Generic, Eq DotProtoPrimType
Eq DotProtoPrimType =>
(DotProtoPrimType -> DotProtoPrimType -> Ordering)
-> (DotProtoPrimType -> DotProtoPrimType -> Bool)
-> (DotProtoPrimType -> DotProtoPrimType -> Bool)
-> (DotProtoPrimType -> DotProtoPrimType -> Bool)
-> (DotProtoPrimType -> DotProtoPrimType -> Bool)
-> (DotProtoPrimType -> DotProtoPrimType -> DotProtoPrimType)
-> (DotProtoPrimType -> DotProtoPrimType -> DotProtoPrimType)
-> Ord DotProtoPrimType
DotProtoPrimType -> DotProtoPrimType -> Bool
DotProtoPrimType -> DotProtoPrimType -> Ordering
DotProtoPrimType -> DotProtoPrimType -> DotProtoPrimType
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: DotProtoPrimType -> DotProtoPrimType -> Ordering
compare :: DotProtoPrimType -> DotProtoPrimType -> Ordering
$c< :: DotProtoPrimType -> DotProtoPrimType -> Bool
< :: DotProtoPrimType -> DotProtoPrimType -> Bool
$c<= :: DotProtoPrimType -> DotProtoPrimType -> Bool
<= :: DotProtoPrimType -> DotProtoPrimType -> Bool
$c> :: DotProtoPrimType -> DotProtoPrimType -> Bool
> :: DotProtoPrimType -> DotProtoPrimType -> Bool
$c>= :: DotProtoPrimType -> DotProtoPrimType -> Bool
>= :: DotProtoPrimType -> DotProtoPrimType -> Bool
$cmax :: DotProtoPrimType -> DotProtoPrimType -> DotProtoPrimType
max :: DotProtoPrimType -> DotProtoPrimType -> DotProtoPrimType
$cmin :: DotProtoPrimType -> DotProtoPrimType -> DotProtoPrimType
min :: DotProtoPrimType -> DotProtoPrimType -> DotProtoPrimType
Ord, Int -> DotProtoPrimType -> String -> String
[DotProtoPrimType] -> String -> String
DotProtoPrimType -> String
(Int -> DotProtoPrimType -> String -> String)
-> (DotProtoPrimType -> String)
-> ([DotProtoPrimType] -> String -> String)
-> Show DotProtoPrimType
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> DotProtoPrimType -> String -> String
showsPrec :: Int -> DotProtoPrimType -> String -> String
$cshow :: DotProtoPrimType -> String
show :: DotProtoPrimType -> String
$cshowList :: [DotProtoPrimType] -> String -> String
showList :: [DotProtoPrimType] -> String -> String
Show)

instance Pretty DotProtoPrimType where
  pPrint :: DotProtoPrimType -> Doc
pPrint (Named DotProtoIdentifier
i)  = DotProtoIdentifier -> Doc
forall a. Pretty a => a -> Doc
pPrint DotProtoIdentifier
i
  pPrint DotProtoPrimType
Int32      = String -> Doc
PP.text String
"int32"
  pPrint DotProtoPrimType
Int64      = String -> Doc
PP.text String
"int64"
  pPrint DotProtoPrimType
SInt32     = String -> Doc
PP.text String
"sint32"
  pPrint DotProtoPrimType
SInt64     = String -> Doc
PP.text String
"sint64"
  pPrint DotProtoPrimType
UInt32     = String -> Doc
PP.text String
"uint32"
  pPrint DotProtoPrimType
UInt64     = String -> Doc
PP.text String
"uint64"
  pPrint DotProtoPrimType
Fixed32    = String -> Doc
PP.text String
"fixed32"
  pPrint DotProtoPrimType
Fixed64    = String -> Doc
PP.text String
"fixed64"
  pPrint DotProtoPrimType
SFixed32   = String -> Doc
PP.text String
"sfixed32"
  pPrint DotProtoPrimType
SFixed64   = String -> Doc
PP.text String
"sfixed64"
  pPrint DotProtoPrimType
String     = String -> Doc
PP.text String
"string"
  pPrint DotProtoPrimType
Bytes      = String -> Doc
PP.text String
"bytes"
  pPrint DotProtoPrimType
Bool       = String -> Doc
PP.text String
"bool"
  pPrint DotProtoPrimType
Float      = String -> Doc
PP.text String
"float"
  pPrint DotProtoPrimType
Double     = String -> Doc
PP.text String
"double"

instance Arbitrary DotProtoPrimType where
  arbitrary :: Gen DotProtoPrimType
arbitrary = [Gen DotProtoPrimType] -> Gen DotProtoPrimType
forall a. HasCallStack => [Gen a] -> Gen a
oneof
    [ [DotProtoPrimType] -> Gen DotProtoPrimType
forall a. HasCallStack => [a] -> Gen a
elements
      [ DotProtoPrimType
Int32
      , DotProtoPrimType
Int64
      , DotProtoPrimType
SInt32
      , DotProtoPrimType
SInt64
      , DotProtoPrimType
UInt32
      , DotProtoPrimType
UInt64
      , DotProtoPrimType
Fixed32
      , DotProtoPrimType
Fixed64
      , DotProtoPrimType
SFixed32
      , DotProtoPrimType
SFixed64
      , DotProtoPrimType
String
      , DotProtoPrimType
Bytes
      , DotProtoPrimType
Bool
      , DotProtoPrimType
Float
      , DotProtoPrimType
Double
      ]
    , (DotProtoIdentifier -> DotProtoPrimType)
-> Gen DotProtoIdentifier -> Gen DotProtoPrimType
forall a b. (a -> b) -> Gen a -> Gen b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap DotProtoIdentifier -> DotProtoPrimType
Named Gen DotProtoIdentifier
arbitrarySingleIdentifier
    ]

data Packing
  = PackedField
  | UnpackedField
  deriving (Packing
Packing -> Packing -> Bounded Packing
forall a. a -> a -> Bounded a
$cminBound :: Packing
minBound :: Packing
$cmaxBound :: Packing
maxBound :: Packing
Bounded, Typeable Packing
Typeable Packing =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> Packing -> c Packing)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Packing)
-> (Packing -> Constr)
-> (Packing -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Packing))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Packing))
-> ((forall b. Data b => b -> b) -> Packing -> Packing)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Packing -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Packing -> r)
-> (forall u. (forall d. Data d => d -> u) -> Packing -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Packing -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Packing -> m Packing)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Packing -> m Packing)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Packing -> m Packing)
-> Data Packing
Packing -> Constr
Packing -> DataType
(forall b. Data b => b -> b) -> Packing -> Packing
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Packing -> u
forall u. (forall d. Data d => d -> u) -> Packing -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Packing -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Packing -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Packing -> m Packing
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Packing -> m Packing
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Packing
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Packing -> c Packing
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Packing)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Packing)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Packing -> c Packing
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Packing -> c Packing
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Packing
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Packing
$ctoConstr :: Packing -> Constr
toConstr :: Packing -> Constr
$cdataTypeOf :: Packing -> DataType
dataTypeOf :: Packing -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Packing)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Packing)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Packing)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Packing)
$cgmapT :: (forall b. Data b => b -> b) -> Packing -> Packing
gmapT :: (forall b. Data b => b -> b) -> Packing -> Packing
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Packing -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Packing -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Packing -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Packing -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Packing -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> Packing -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Packing -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Packing -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Packing -> m Packing
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Packing -> m Packing
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Packing -> m Packing
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Packing -> m Packing
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Packing -> m Packing
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Packing -> m Packing
Data, Int -> Packing
Packing -> Int
Packing -> [Packing]
Packing -> Packing
Packing -> Packing -> [Packing]
Packing -> Packing -> Packing -> [Packing]
(Packing -> Packing)
-> (Packing -> Packing)
-> (Int -> Packing)
-> (Packing -> Int)
-> (Packing -> [Packing])
-> (Packing -> Packing -> [Packing])
-> (Packing -> Packing -> [Packing])
-> (Packing -> Packing -> Packing -> [Packing])
-> Enum Packing
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: Packing -> Packing
succ :: Packing -> Packing
$cpred :: Packing -> Packing
pred :: Packing -> Packing
$ctoEnum :: Int -> Packing
toEnum :: Int -> Packing
$cfromEnum :: Packing -> Int
fromEnum :: Packing -> Int
$cenumFrom :: Packing -> [Packing]
enumFrom :: Packing -> [Packing]
$cenumFromThen :: Packing -> Packing -> [Packing]
enumFromThen :: Packing -> Packing -> [Packing]
$cenumFromTo :: Packing -> Packing -> [Packing]
enumFromTo :: Packing -> Packing -> [Packing]
$cenumFromThenTo :: Packing -> Packing -> Packing -> [Packing]
enumFromThenTo :: Packing -> Packing -> Packing -> [Packing]
Enum, Packing -> Packing -> Bool
(Packing -> Packing -> Bool)
-> (Packing -> Packing -> Bool) -> Eq Packing
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Packing -> Packing -> Bool
== :: Packing -> Packing -> Bool
$c/= :: Packing -> Packing -> Bool
/= :: Packing -> Packing -> Bool
Eq, (forall x. Packing -> Rep Packing x)
-> (forall x. Rep Packing x -> Packing) -> Generic Packing
forall x. Rep Packing x -> Packing
forall x. Packing -> Rep Packing x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Packing -> Rep Packing x
from :: forall x. Packing -> Rep Packing x
$cto :: forall x. Rep Packing x -> Packing
to :: forall x. Rep Packing x -> Packing
Generic, Eq Packing
Eq Packing =>
(Packing -> Packing -> Ordering)
-> (Packing -> Packing -> Bool)
-> (Packing -> Packing -> Bool)
-> (Packing -> Packing -> Bool)
-> (Packing -> Packing -> Bool)
-> (Packing -> Packing -> Packing)
-> (Packing -> Packing -> Packing)
-> Ord Packing
Packing -> Packing -> Bool
Packing -> Packing -> Ordering
Packing -> Packing -> Packing
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Packing -> Packing -> Ordering
compare :: Packing -> Packing -> Ordering
$c< :: Packing -> Packing -> Bool
< :: Packing -> Packing -> Bool
$c<= :: Packing -> Packing -> Bool
<= :: Packing -> Packing -> Bool
$c> :: Packing -> Packing -> Bool
> :: Packing -> Packing -> Bool
$c>= :: Packing -> Packing -> Bool
>= :: Packing -> Packing -> Bool
$cmax :: Packing -> Packing -> Packing
max :: Packing -> Packing -> Packing
$cmin :: Packing -> Packing -> Packing
min :: Packing -> Packing -> Packing
Ord, Int -> Packing -> String -> String
[Packing] -> String -> String
Packing -> String
(Int -> Packing -> String -> String)
-> (Packing -> String)
-> ([Packing] -> String -> String)
-> Show Packing
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> Packing -> String -> String
showsPrec :: Int -> Packing -> String -> String
$cshow :: Packing -> String
show :: Packing -> String
$cshowList :: [Packing] -> String -> String
showList :: [Packing] -> String -> String
Show)

instance Arbitrary Packing where
  arbitrary :: Gen Packing
arbitrary = [Packing] -> Gen Packing
forall a. HasCallStack => [a] -> Gen a
elements [Packing
PackedField, Packing
UnpackedField]

-- | This type is an almagamation of the modifiers used in types.
--   It corresponds to a syntax role but not a semantic role, not all modifiers
--   are meaningful in every type context.
data DotProtoType
  = Prim           DotProtoPrimType
  | Optional       DotProtoPrimType
  | Repeated       DotProtoPrimType
  | NestedRepeated DotProtoPrimType
  | Map            DotProtoPrimType DotProtoPrimType
  deriving (Typeable DotProtoType
Typeable DotProtoType =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> DotProtoType -> c DotProtoType)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c DotProtoType)
-> (DotProtoType -> Constr)
-> (DotProtoType -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c DotProtoType))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c DotProtoType))
-> ((forall b. Data b => b -> b) -> DotProtoType -> DotProtoType)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoType -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoType -> r)
-> (forall u. (forall d. Data d => d -> u) -> DotProtoType -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> DotProtoType -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> DotProtoType -> m DotProtoType)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> DotProtoType -> m DotProtoType)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> DotProtoType -> m DotProtoType)
-> Data DotProtoType
DotProtoType -> Constr
DotProtoType -> DataType
(forall b. Data b => b -> b) -> DotProtoType -> DotProtoType
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> DotProtoType -> u
forall u. (forall d. Data d => d -> u) -> DotProtoType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DotProtoType -> m DotProtoType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DotProtoType -> m DotProtoType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProtoType -> c DotProtoType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoType)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProtoType -> c DotProtoType
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProtoType -> c DotProtoType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoType
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoType
$ctoConstr :: DotProtoType -> Constr
toConstr :: DotProtoType -> Constr
$cdataTypeOf :: DotProtoType -> DataType
dataTypeOf :: DotProtoType -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoType)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoType)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoType)
$cgmapT :: (forall b. Data b => b -> b) -> DotProtoType -> DotProtoType
gmapT :: (forall b. Data b => b -> b) -> DotProtoType -> DotProtoType
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoType -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoType -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoType -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> DotProtoType -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> DotProtoType -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> DotProtoType -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> DotProtoType -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DotProtoType -> m DotProtoType
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DotProtoType -> m DotProtoType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DotProtoType -> m DotProtoType
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DotProtoType -> m DotProtoType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DotProtoType -> m DotProtoType
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DotProtoType -> m DotProtoType
Data, DotProtoType -> DotProtoType -> Bool
(DotProtoType -> DotProtoType -> Bool)
-> (DotProtoType -> DotProtoType -> Bool) -> Eq DotProtoType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DotProtoType -> DotProtoType -> Bool
== :: DotProtoType -> DotProtoType -> Bool
$c/= :: DotProtoType -> DotProtoType -> Bool
/= :: DotProtoType -> DotProtoType -> Bool
Eq, (forall x. DotProtoType -> Rep DotProtoType x)
-> (forall x. Rep DotProtoType x -> DotProtoType)
-> Generic DotProtoType
forall x. Rep DotProtoType x -> DotProtoType
forall x. DotProtoType -> Rep DotProtoType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. DotProtoType -> Rep DotProtoType x
from :: forall x. DotProtoType -> Rep DotProtoType x
$cto :: forall x. Rep DotProtoType x -> DotProtoType
to :: forall x. Rep DotProtoType x -> DotProtoType
Generic, Eq DotProtoType
Eq DotProtoType =>
(DotProtoType -> DotProtoType -> Ordering)
-> (DotProtoType -> DotProtoType -> Bool)
-> (DotProtoType -> DotProtoType -> Bool)
-> (DotProtoType -> DotProtoType -> Bool)
-> (DotProtoType -> DotProtoType -> Bool)
-> (DotProtoType -> DotProtoType -> DotProtoType)
-> (DotProtoType -> DotProtoType -> DotProtoType)
-> Ord DotProtoType
DotProtoType -> DotProtoType -> Bool
DotProtoType -> DotProtoType -> Ordering
DotProtoType -> DotProtoType -> DotProtoType
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: DotProtoType -> DotProtoType -> Ordering
compare :: DotProtoType -> DotProtoType -> Ordering
$c< :: DotProtoType -> DotProtoType -> Bool
< :: DotProtoType -> DotProtoType -> Bool
$c<= :: DotProtoType -> DotProtoType -> Bool
<= :: DotProtoType -> DotProtoType -> Bool
$c> :: DotProtoType -> DotProtoType -> Bool
> :: DotProtoType -> DotProtoType -> Bool
$c>= :: DotProtoType -> DotProtoType -> Bool
>= :: DotProtoType -> DotProtoType -> Bool
$cmax :: DotProtoType -> DotProtoType -> DotProtoType
max :: DotProtoType -> DotProtoType -> DotProtoType
$cmin :: DotProtoType -> DotProtoType -> DotProtoType
min :: DotProtoType -> DotProtoType -> DotProtoType
Ord, Int -> DotProtoType -> String -> String
[DotProtoType] -> String -> String
DotProtoType -> String
(Int -> DotProtoType -> String -> String)
-> (DotProtoType -> String)
-> ([DotProtoType] -> String -> String)
-> Show DotProtoType
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> DotProtoType -> String -> String
showsPrec :: Int -> DotProtoType -> String -> String
$cshow :: DotProtoType -> String
show :: DotProtoType -> String
$cshowList :: [DotProtoType] -> String -> String
showList :: [DotProtoType] -> String -> String
Show)

instance Pretty DotProtoType where
  pPrint :: DotProtoType -> Doc
pPrint (Prim           DotProtoPrimType
ty) = DotProtoPrimType -> Doc
forall a. Pretty a => a -> Doc
pPrint DotProtoPrimType
ty
  pPrint (Optional       DotProtoPrimType
ty) = String -> Doc
PP.text String
"optional" Doc -> Doc -> Doc
<+> DotProtoPrimType -> Doc
forall a. Pretty a => a -> Doc
pPrint DotProtoPrimType
ty
  pPrint (Repeated       DotProtoPrimType
ty) = String -> Doc
PP.text String
"repeated" Doc -> Doc -> Doc
<+> DotProtoPrimType -> Doc
forall a. Pretty a => a -> Doc
pPrint DotProtoPrimType
ty
  pPrint (NestedRepeated DotProtoPrimType
ty) = String -> Doc
PP.text String
"repeated" Doc -> Doc -> Doc
<+> DotProtoPrimType -> Doc
forall a. Pretty a => a -> Doc
pPrint DotProtoPrimType
ty
  pPrint (Map DotProtoPrimType
keyty DotProtoPrimType
valuety) = String -> Doc
PP.text String
"map<" Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> DotProtoPrimType -> Doc
forall a. Pretty a => a -> Doc
pPrint DotProtoPrimType
keyty Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
PP.text String
", " Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> DotProtoPrimType -> Doc
forall a. Pretty a => a -> Doc
pPrint DotProtoPrimType
valuety Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
PP.text String
">"

instance Arbitrary DotProtoType where
  arbitrary :: Gen DotProtoType
arbitrary = [Gen DotProtoType] -> Gen DotProtoType
forall a. HasCallStack => [Gen a] -> Gen a
oneof [(DotProtoPrimType -> DotProtoType)
-> Gen DotProtoPrimType -> Gen DotProtoType
forall a b. (a -> b) -> Gen a -> Gen b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap DotProtoPrimType -> DotProtoType
Prim Gen DotProtoPrimType
forall a. Arbitrary a => Gen a
arbitrary]

type DotProtoEnumValue = Int32

data DotProtoEnumPart
  = DotProtoEnumField DotProtoIdentifier DotProtoEnumValue [DotProtoOption]
  | DotProtoEnumOption DotProtoOption
  | DotProtoEnumReserved   [DotProtoReservedField]
  deriving (Typeable DotProtoEnumPart
Typeable DotProtoEnumPart =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> DotProtoEnumPart -> c DotProtoEnumPart)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c DotProtoEnumPart)
-> (DotProtoEnumPart -> Constr)
-> (DotProtoEnumPart -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c DotProtoEnumPart))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c DotProtoEnumPart))
-> ((forall b. Data b => b -> b)
    -> DotProtoEnumPart -> DotProtoEnumPart)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoEnumPart -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoEnumPart -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> DotProtoEnumPart -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> DotProtoEnumPart -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> DotProtoEnumPart -> m DotProtoEnumPart)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> DotProtoEnumPart -> m DotProtoEnumPart)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> DotProtoEnumPart -> m DotProtoEnumPart)
-> Data DotProtoEnumPart
DotProtoEnumPart -> Constr
DotProtoEnumPart -> DataType
(forall b. Data b => b -> b)
-> DotProtoEnumPart -> DotProtoEnumPart
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoEnumPart -> u
forall u. (forall d. Data d => d -> u) -> DotProtoEnumPart -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoEnumPart -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoEnumPart -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoEnumPart -> m DotProtoEnumPart
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoEnumPart -> m DotProtoEnumPart
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoEnumPart
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProtoEnumPart -> c DotProtoEnumPart
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoEnumPart)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoEnumPart)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProtoEnumPart -> c DotProtoEnumPart
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProtoEnumPart -> c DotProtoEnumPart
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoEnumPart
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoEnumPart
$ctoConstr :: DotProtoEnumPart -> Constr
toConstr :: DotProtoEnumPart -> Constr
$cdataTypeOf :: DotProtoEnumPart -> DataType
dataTypeOf :: DotProtoEnumPart -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoEnumPart)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoEnumPart)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoEnumPart)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoEnumPart)
$cgmapT :: (forall b. Data b => b -> b)
-> DotProtoEnumPart -> DotProtoEnumPart
gmapT :: (forall b. Data b => b -> b)
-> DotProtoEnumPart -> DotProtoEnumPart
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoEnumPart -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoEnumPart -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoEnumPart -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoEnumPart -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> DotProtoEnumPart -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> DotProtoEnumPart -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoEnumPart -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoEnumPart -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoEnumPart -> m DotProtoEnumPart
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoEnumPart -> m DotProtoEnumPart
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoEnumPart -> m DotProtoEnumPart
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoEnumPart -> m DotProtoEnumPart
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoEnumPart -> m DotProtoEnumPart
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoEnumPart -> m DotProtoEnumPart
Data, DotProtoEnumPart -> DotProtoEnumPart -> Bool
(DotProtoEnumPart -> DotProtoEnumPart -> Bool)
-> (DotProtoEnumPart -> DotProtoEnumPart -> Bool)
-> Eq DotProtoEnumPart
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DotProtoEnumPart -> DotProtoEnumPart -> Bool
== :: DotProtoEnumPart -> DotProtoEnumPart -> Bool
$c/= :: DotProtoEnumPart -> DotProtoEnumPart -> Bool
/= :: DotProtoEnumPart -> DotProtoEnumPart -> Bool
Eq, (forall x. DotProtoEnumPart -> Rep DotProtoEnumPart x)
-> (forall x. Rep DotProtoEnumPart x -> DotProtoEnumPart)
-> Generic DotProtoEnumPart
forall x. Rep DotProtoEnumPart x -> DotProtoEnumPart
forall x. DotProtoEnumPart -> Rep DotProtoEnumPart x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. DotProtoEnumPart -> Rep DotProtoEnumPart x
from :: forall x. DotProtoEnumPart -> Rep DotProtoEnumPart x
$cto :: forall x. Rep DotProtoEnumPart x -> DotProtoEnumPart
to :: forall x. Rep DotProtoEnumPart x -> DotProtoEnumPart
Generic, Eq DotProtoEnumPart
Eq DotProtoEnumPart =>
(DotProtoEnumPart -> DotProtoEnumPart -> Ordering)
-> (DotProtoEnumPart -> DotProtoEnumPart -> Bool)
-> (DotProtoEnumPart -> DotProtoEnumPart -> Bool)
-> (DotProtoEnumPart -> DotProtoEnumPart -> Bool)
-> (DotProtoEnumPart -> DotProtoEnumPart -> Bool)
-> (DotProtoEnumPart -> DotProtoEnumPart -> DotProtoEnumPart)
-> (DotProtoEnumPart -> DotProtoEnumPart -> DotProtoEnumPart)
-> Ord DotProtoEnumPart
DotProtoEnumPart -> DotProtoEnumPart -> Bool
DotProtoEnumPart -> DotProtoEnumPart -> Ordering
DotProtoEnumPart -> DotProtoEnumPart -> DotProtoEnumPart
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: DotProtoEnumPart -> DotProtoEnumPart -> Ordering
compare :: DotProtoEnumPart -> DotProtoEnumPart -> Ordering
$c< :: DotProtoEnumPart -> DotProtoEnumPart -> Bool
< :: DotProtoEnumPart -> DotProtoEnumPart -> Bool
$c<= :: DotProtoEnumPart -> DotProtoEnumPart -> Bool
<= :: DotProtoEnumPart -> DotProtoEnumPart -> Bool
$c> :: DotProtoEnumPart -> DotProtoEnumPart -> Bool
> :: DotProtoEnumPart -> DotProtoEnumPart -> Bool
$c>= :: DotProtoEnumPart -> DotProtoEnumPart -> Bool
>= :: DotProtoEnumPart -> DotProtoEnumPart -> Bool
$cmax :: DotProtoEnumPart -> DotProtoEnumPart -> DotProtoEnumPart
max :: DotProtoEnumPart -> DotProtoEnumPart -> DotProtoEnumPart
$cmin :: DotProtoEnumPart -> DotProtoEnumPart -> DotProtoEnumPart
min :: DotProtoEnumPart -> DotProtoEnumPart -> DotProtoEnumPart
Ord, Int -> DotProtoEnumPart -> String -> String
[DotProtoEnumPart] -> String -> String
DotProtoEnumPart -> String
(Int -> DotProtoEnumPart -> String -> String)
-> (DotProtoEnumPart -> String)
-> ([DotProtoEnumPart] -> String -> String)
-> Show DotProtoEnumPart
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> DotProtoEnumPart -> String -> String
showsPrec :: Int -> DotProtoEnumPart -> String -> String
$cshow :: DotProtoEnumPart -> String
show :: DotProtoEnumPart -> String
$cshowList :: [DotProtoEnumPart] -> String -> String
showList :: [DotProtoEnumPart] -> String -> String
Show)

instance Arbitrary DotProtoEnumPart where
  arbitrary :: Gen DotProtoEnumPart
arbitrary = [Gen DotProtoEnumPart] -> Gen DotProtoEnumPart
forall a. HasCallStack => [Gen a] -> Gen a
oneof [Gen DotProtoEnumPart
arbitraryField, Gen DotProtoEnumPart
arbitraryOption]
    where
      arbitraryField :: Gen DotProtoEnumPart
arbitraryField = do
        DotProtoIdentifier
identifier <- Gen DotProtoIdentifier
arbitraryIdentifier
        DotProtoEnumValue
enumValue  <- Gen DotProtoEnumValue
forall a. Arbitrary a => Gen a
arbitrary
        [DotProtoOption]
opts       <- Gen [DotProtoOption]
forall a. Arbitrary a => Gen a
arbitrary
        DotProtoEnumPart -> Gen DotProtoEnumPart
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return (DotProtoIdentifier
-> DotProtoEnumValue -> [DotProtoOption] -> DotProtoEnumPart
DotProtoEnumField DotProtoIdentifier
identifier DotProtoEnumValue
enumValue [DotProtoOption]
opts)

      arbitraryOption :: Gen DotProtoEnumPart
arbitraryOption = do
        DotProtoOption
option <- Gen DotProtoOption
forall a. Arbitrary a => Gen a
arbitrary
        DotProtoEnumPart -> Gen DotProtoEnumPart
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return (DotProtoOption -> DotProtoEnumPart
DotProtoEnumOption DotProtoOption
option)

data Streaming
  = Streaming
  | NonStreaming
  deriving (Streaming
Streaming -> Streaming -> Bounded Streaming
forall a. a -> a -> Bounded a
$cminBound :: Streaming
minBound :: Streaming
$cmaxBound :: Streaming
maxBound :: Streaming
Bounded, Typeable Streaming
Typeable Streaming =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> Streaming -> c Streaming)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Streaming)
-> (Streaming -> Constr)
-> (Streaming -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Streaming))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Streaming))
-> ((forall b. Data b => b -> b) -> Streaming -> Streaming)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Streaming -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Streaming -> r)
-> (forall u. (forall d. Data d => d -> u) -> Streaming -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> Streaming -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Streaming -> m Streaming)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Streaming -> m Streaming)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Streaming -> m Streaming)
-> Data Streaming
Streaming -> Constr
Streaming -> DataType
(forall b. Data b => b -> b) -> Streaming -> Streaming
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Streaming -> u
forall u. (forall d. Data d => d -> u) -> Streaming -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Streaming -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Streaming -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Streaming -> m Streaming
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Streaming -> m Streaming
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Streaming
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Streaming -> c Streaming
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Streaming)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Streaming)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Streaming -> c Streaming
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Streaming -> c Streaming
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Streaming
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Streaming
$ctoConstr :: Streaming -> Constr
toConstr :: Streaming -> Constr
$cdataTypeOf :: Streaming -> DataType
dataTypeOf :: Streaming -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Streaming)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Streaming)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Streaming)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Streaming)
$cgmapT :: (forall b. Data b => b -> b) -> Streaming -> Streaming
gmapT :: (forall b. Data b => b -> b) -> Streaming -> Streaming
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Streaming -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Streaming -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Streaming -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Streaming -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Streaming -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> Streaming -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Streaming -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Streaming -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Streaming -> m Streaming
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Streaming -> m Streaming
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Streaming -> m Streaming
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Streaming -> m Streaming
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Streaming -> m Streaming
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Streaming -> m Streaming
Data, Int -> Streaming
Streaming -> Int
Streaming -> [Streaming]
Streaming -> Streaming
Streaming -> Streaming -> [Streaming]
Streaming -> Streaming -> Streaming -> [Streaming]
(Streaming -> Streaming)
-> (Streaming -> Streaming)
-> (Int -> Streaming)
-> (Streaming -> Int)
-> (Streaming -> [Streaming])
-> (Streaming -> Streaming -> [Streaming])
-> (Streaming -> Streaming -> [Streaming])
-> (Streaming -> Streaming -> Streaming -> [Streaming])
-> Enum Streaming
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: Streaming -> Streaming
succ :: Streaming -> Streaming
$cpred :: Streaming -> Streaming
pred :: Streaming -> Streaming
$ctoEnum :: Int -> Streaming
toEnum :: Int -> Streaming
$cfromEnum :: Streaming -> Int
fromEnum :: Streaming -> Int
$cenumFrom :: Streaming -> [Streaming]
enumFrom :: Streaming -> [Streaming]
$cenumFromThen :: Streaming -> Streaming -> [Streaming]
enumFromThen :: Streaming -> Streaming -> [Streaming]
$cenumFromTo :: Streaming -> Streaming -> [Streaming]
enumFromTo :: Streaming -> Streaming -> [Streaming]
$cenumFromThenTo :: Streaming -> Streaming -> Streaming -> [Streaming]
enumFromThenTo :: Streaming -> Streaming -> Streaming -> [Streaming]
Enum, Streaming -> Streaming -> Bool
(Streaming -> Streaming -> Bool)
-> (Streaming -> Streaming -> Bool) -> Eq Streaming
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Streaming -> Streaming -> Bool
== :: Streaming -> Streaming -> Bool
$c/= :: Streaming -> Streaming -> Bool
/= :: Streaming -> Streaming -> Bool
Eq, (forall x. Streaming -> Rep Streaming x)
-> (forall x. Rep Streaming x -> Streaming) -> Generic Streaming
forall x. Rep Streaming x -> Streaming
forall x. Streaming -> Rep Streaming x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Streaming -> Rep Streaming x
from :: forall x. Streaming -> Rep Streaming x
$cto :: forall x. Rep Streaming x -> Streaming
to :: forall x. Rep Streaming x -> Streaming
Generic, Eq Streaming
Eq Streaming =>
(Streaming -> Streaming -> Ordering)
-> (Streaming -> Streaming -> Bool)
-> (Streaming -> Streaming -> Bool)
-> (Streaming -> Streaming -> Bool)
-> (Streaming -> Streaming -> Bool)
-> (Streaming -> Streaming -> Streaming)
-> (Streaming -> Streaming -> Streaming)
-> Ord Streaming
Streaming -> Streaming -> Bool
Streaming -> Streaming -> Ordering
Streaming -> Streaming -> Streaming
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Streaming -> Streaming -> Ordering
compare :: Streaming -> Streaming -> Ordering
$c< :: Streaming -> Streaming -> Bool
< :: Streaming -> Streaming -> Bool
$c<= :: Streaming -> Streaming -> Bool
<= :: Streaming -> Streaming -> Bool
$c> :: Streaming -> Streaming -> Bool
> :: Streaming -> Streaming -> Bool
$c>= :: Streaming -> Streaming -> Bool
>= :: Streaming -> Streaming -> Bool
$cmax :: Streaming -> Streaming -> Streaming
max :: Streaming -> Streaming -> Streaming
$cmin :: Streaming -> Streaming -> Streaming
min :: Streaming -> Streaming -> Streaming
Ord, Int -> Streaming -> String -> String
[Streaming] -> String -> String
Streaming -> String
(Int -> Streaming -> String -> String)
-> (Streaming -> String)
-> ([Streaming] -> String -> String)
-> Show Streaming
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> Streaming -> String -> String
showsPrec :: Int -> Streaming -> String -> String
$cshow :: Streaming -> String
show :: Streaming -> String
$cshowList :: [Streaming] -> String -> String
showList :: [Streaming] -> String -> String
Show)

instance Pretty Streaming where
  pPrint :: Streaming -> Doc
pPrint Streaming
Streaming    = String -> Doc
PP.text String
"stream"
  pPrint Streaming
NonStreaming = Doc
PP.empty

instance Arbitrary Streaming where
  arbitrary :: Gen Streaming
arbitrary = [Streaming] -> Gen Streaming
forall a. HasCallStack => [a] -> Gen a
elements [Streaming
Streaming, Streaming
NonStreaming]

data DotProtoServicePart
  = DotProtoServiceRPCMethod RPCMethod
  | DotProtoServiceOption DotProtoOption
  deriving (Typeable DotProtoServicePart
Typeable DotProtoServicePart =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g)
 -> DotProtoServicePart
 -> c DotProtoServicePart)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c DotProtoServicePart)
-> (DotProtoServicePart -> Constr)
-> (DotProtoServicePart -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c DotProtoServicePart))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c DotProtoServicePart))
-> ((forall b. Data b => b -> b)
    -> DotProtoServicePart -> DotProtoServicePart)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoServicePart -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoServicePart -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> DotProtoServicePart -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> DotProtoServicePart -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> DotProtoServicePart -> m DotProtoServicePart)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> DotProtoServicePart -> m DotProtoServicePart)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> DotProtoServicePart -> m DotProtoServicePart)
-> Data DotProtoServicePart
DotProtoServicePart -> Constr
DotProtoServicePart -> DataType
(forall b. Data b => b -> b)
-> DotProtoServicePart -> DotProtoServicePart
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoServicePart -> u
forall u.
(forall d. Data d => d -> u) -> DotProtoServicePart -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoServicePart -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoServicePart -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoServicePart -> m DotProtoServicePart
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoServicePart -> m DotProtoServicePart
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoServicePart
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> DotProtoServicePart
-> c DotProtoServicePart
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoServicePart)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoServicePart)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> DotProtoServicePart
-> c DotProtoServicePart
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> DotProtoServicePart
-> c DotProtoServicePart
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoServicePart
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoServicePart
$ctoConstr :: DotProtoServicePart -> Constr
toConstr :: DotProtoServicePart -> Constr
$cdataTypeOf :: DotProtoServicePart -> DataType
dataTypeOf :: DotProtoServicePart -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoServicePart)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoServicePart)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoServicePart)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoServicePart)
$cgmapT :: (forall b. Data b => b -> b)
-> DotProtoServicePart -> DotProtoServicePart
gmapT :: (forall b. Data b => b -> b)
-> DotProtoServicePart -> DotProtoServicePart
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoServicePart -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoServicePart -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoServicePart -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoServicePart -> r
$cgmapQ :: forall u.
(forall d. Data d => d -> u) -> DotProtoServicePart -> [u]
gmapQ :: forall u.
(forall d. Data d => d -> u) -> DotProtoServicePart -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoServicePart -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoServicePart -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoServicePart -> m DotProtoServicePart
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoServicePart -> m DotProtoServicePart
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoServicePart -> m DotProtoServicePart
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoServicePart -> m DotProtoServicePart
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoServicePart -> m DotProtoServicePart
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoServicePart -> m DotProtoServicePart
Data, DotProtoServicePart -> DotProtoServicePart -> Bool
(DotProtoServicePart -> DotProtoServicePart -> Bool)
-> (DotProtoServicePart -> DotProtoServicePart -> Bool)
-> Eq DotProtoServicePart
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DotProtoServicePart -> DotProtoServicePart -> Bool
== :: DotProtoServicePart -> DotProtoServicePart -> Bool
$c/= :: DotProtoServicePart -> DotProtoServicePart -> Bool
/= :: DotProtoServicePart -> DotProtoServicePart -> Bool
Eq, (forall x. DotProtoServicePart -> Rep DotProtoServicePart x)
-> (forall x. Rep DotProtoServicePart x -> DotProtoServicePart)
-> Generic DotProtoServicePart
forall x. Rep DotProtoServicePart x -> DotProtoServicePart
forall x. DotProtoServicePart -> Rep DotProtoServicePart x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. DotProtoServicePart -> Rep DotProtoServicePart x
from :: forall x. DotProtoServicePart -> Rep DotProtoServicePart x
$cto :: forall x. Rep DotProtoServicePart x -> DotProtoServicePart
to :: forall x. Rep DotProtoServicePart x -> DotProtoServicePart
Generic, Eq DotProtoServicePart
Eq DotProtoServicePart =>
(DotProtoServicePart -> DotProtoServicePart -> Ordering)
-> (DotProtoServicePart -> DotProtoServicePart -> Bool)
-> (DotProtoServicePart -> DotProtoServicePart -> Bool)
-> (DotProtoServicePart -> DotProtoServicePart -> Bool)
-> (DotProtoServicePart -> DotProtoServicePart -> Bool)
-> (DotProtoServicePart
    -> DotProtoServicePart -> DotProtoServicePart)
-> (DotProtoServicePart
    -> DotProtoServicePart -> DotProtoServicePart)
-> Ord DotProtoServicePart
DotProtoServicePart -> DotProtoServicePart -> Bool
DotProtoServicePart -> DotProtoServicePart -> Ordering
DotProtoServicePart -> DotProtoServicePart -> DotProtoServicePart
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: DotProtoServicePart -> DotProtoServicePart -> Ordering
compare :: DotProtoServicePart -> DotProtoServicePart -> Ordering
$c< :: DotProtoServicePart -> DotProtoServicePart -> Bool
< :: DotProtoServicePart -> DotProtoServicePart -> Bool
$c<= :: DotProtoServicePart -> DotProtoServicePart -> Bool
<= :: DotProtoServicePart -> DotProtoServicePart -> Bool
$c> :: DotProtoServicePart -> DotProtoServicePart -> Bool
> :: DotProtoServicePart -> DotProtoServicePart -> Bool
$c>= :: DotProtoServicePart -> DotProtoServicePart -> Bool
>= :: DotProtoServicePart -> DotProtoServicePart -> Bool
$cmax :: DotProtoServicePart -> DotProtoServicePart -> DotProtoServicePart
max :: DotProtoServicePart -> DotProtoServicePart -> DotProtoServicePart
$cmin :: DotProtoServicePart -> DotProtoServicePart -> DotProtoServicePart
min :: DotProtoServicePart -> DotProtoServicePart -> DotProtoServicePart
Ord, Int -> DotProtoServicePart -> String -> String
[DotProtoServicePart] -> String -> String
DotProtoServicePart -> String
(Int -> DotProtoServicePart -> String -> String)
-> (DotProtoServicePart -> String)
-> ([DotProtoServicePart] -> String -> String)
-> Show DotProtoServicePart
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> DotProtoServicePart -> String -> String
showsPrec :: Int -> DotProtoServicePart -> String -> String
$cshow :: DotProtoServicePart -> String
show :: DotProtoServicePart -> String
$cshowList :: [DotProtoServicePart] -> String -> String
showList :: [DotProtoServicePart] -> String -> String
Show)

instance Pretty DotProtoServicePart where
  pPrint :: DotProtoServicePart -> Doc
pPrint (DotProtoServiceRPCMethod RPCMethod{[DotProtoOption]
Streaming
DotProtoIdentifier
rpcMethodName :: DotProtoIdentifier
rpcMethodRequestType :: DotProtoIdentifier
rpcMethodRequestStreaming :: Streaming
rpcMethodResponseType :: DotProtoIdentifier
rpcMethodResponseStreaming :: Streaming
rpcMethodOptions :: [DotProtoOption]
rpcMethodOptions :: RPCMethod -> [DotProtoOption]
rpcMethodResponseStreaming :: RPCMethod -> Streaming
rpcMethodResponseType :: RPCMethod -> DotProtoIdentifier
rpcMethodRequestStreaming :: RPCMethod -> Streaming
rpcMethodRequestType :: RPCMethod -> DotProtoIdentifier
rpcMethodName :: RPCMethod -> DotProtoIdentifier
..})
    =   String -> Doc
PP.text String
"rpc"
    Doc -> Doc -> Doc
<+> DotProtoIdentifier -> Doc
forall a. Pretty a => a -> Doc
pPrint DotProtoIdentifier
rpcMethodName
    Doc -> Doc -> Doc
<+> Doc -> Doc
PP.parens (Streaming -> Doc
forall a. Pretty a => a -> Doc
pPrint Streaming
rpcMethodRequestStreaming Doc -> Doc -> Doc
<+> DotProtoIdentifier -> Doc
forall a. Pretty a => a -> Doc
pPrint DotProtoIdentifier
rpcMethodRequestType)
    Doc -> Doc -> Doc
<+> String -> Doc
PP.text String
"returns"
    Doc -> Doc -> Doc
<+> Doc -> Doc
PP.parens (Streaming -> Doc
forall a. Pretty a => a -> Doc
pPrint Streaming
rpcMethodResponseStreaming Doc -> Doc -> Doc
<+> DotProtoIdentifier -> Doc
forall a. Pretty a => a -> Doc
pPrint DotProtoIdentifier
rpcMethodResponseType)
    Doc -> Doc -> Doc
<+> case [DotProtoOption]
rpcMethodOptions of
          [] -> String -> Doc
PP.text String
";"
          [DotProtoOption]
_  -> Doc -> Doc
PP.braces (Doc -> Doc) -> ([Doc] -> Doc) -> [Doc] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Doc] -> Doc
PP.vcat ([Doc] -> Doc) -> [Doc] -> Doc
forall a b. (a -> b) -> a -> b
$ DotProtoOption -> Doc
serviceOption (DotProtoOption -> Doc) -> [DotProtoOption] -> [Doc]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [DotProtoOption]
rpcMethodOptions
  pPrint (DotProtoServiceOption DotProtoOption
option) = DotProtoOption -> Doc
serviceOption DotProtoOption
option

instance Arbitrary DotProtoServicePart where
  arbitrary :: Gen DotProtoServicePart
arbitrary = [Gen DotProtoServicePart] -> Gen DotProtoServicePart
forall a. HasCallStack => [Gen a] -> Gen a
oneof
    [ RPCMethod -> DotProtoServicePart
DotProtoServiceRPCMethod (RPCMethod -> DotProtoServicePart)
-> Gen RPCMethod -> Gen DotProtoServicePart
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen RPCMethod
forall a. Arbitrary a => Gen a
arbitrary
    , DotProtoOption -> DotProtoServicePart
DotProtoServiceOption (DotProtoOption -> DotProtoServicePart)
-> Gen DotProtoOption -> Gen DotProtoServicePart
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen DotProtoOption
forall a. Arbitrary a => Gen a
arbitrary
    ]

data RPCMethod = RPCMethod
  { RPCMethod -> DotProtoIdentifier
rpcMethodName :: DotProtoIdentifier
  , RPCMethod -> DotProtoIdentifier
rpcMethodRequestType :: DotProtoIdentifier
  , RPCMethod -> Streaming
rpcMethodRequestStreaming :: Streaming
  , RPCMethod -> DotProtoIdentifier
rpcMethodResponseType :: DotProtoIdentifier
  , RPCMethod -> Streaming
rpcMethodResponseStreaming :: Streaming
  , RPCMethod -> [DotProtoOption]
rpcMethodOptions :: [DotProtoOption]
  }
  deriving (Typeable RPCMethod
Typeable RPCMethod =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> RPCMethod -> c RPCMethod)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c RPCMethod)
-> (RPCMethod -> Constr)
-> (RPCMethod -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c RPCMethod))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RPCMethod))
-> ((forall b. Data b => b -> b) -> RPCMethod -> RPCMethod)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> RPCMethod -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> RPCMethod -> r)
-> (forall u. (forall d. Data d => d -> u) -> RPCMethod -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> RPCMethod -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> RPCMethod -> m RPCMethod)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> RPCMethod -> m RPCMethod)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> RPCMethod -> m RPCMethod)
-> Data RPCMethod
RPCMethod -> Constr
RPCMethod -> DataType
(forall b. Data b => b -> b) -> RPCMethod -> RPCMethod
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> RPCMethod -> u
forall u. (forall d. Data d => d -> u) -> RPCMethod -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RPCMethod -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RPCMethod -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> RPCMethod -> m RPCMethod
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RPCMethod -> m RPCMethod
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RPCMethod
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RPCMethod -> c RPCMethod
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c RPCMethod)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RPCMethod)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RPCMethod -> c RPCMethod
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RPCMethod -> c RPCMethod
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RPCMethod
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RPCMethod
$ctoConstr :: RPCMethod -> Constr
toConstr :: RPCMethod -> Constr
$cdataTypeOf :: RPCMethod -> DataType
dataTypeOf :: RPCMethod -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c RPCMethod)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c RPCMethod)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RPCMethod)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RPCMethod)
$cgmapT :: (forall b. Data b => b -> b) -> RPCMethod -> RPCMethod
gmapT :: (forall b. Data b => b -> b) -> RPCMethod -> RPCMethod
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RPCMethod -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RPCMethod -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RPCMethod -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RPCMethod -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> RPCMethod -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> RPCMethod -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> RPCMethod -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> RPCMethod -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> RPCMethod -> m RPCMethod
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> RPCMethod -> m RPCMethod
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RPCMethod -> m RPCMethod
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RPCMethod -> m RPCMethod
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RPCMethod -> m RPCMethod
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RPCMethod -> m RPCMethod
Data, RPCMethod -> RPCMethod -> Bool
(RPCMethod -> RPCMethod -> Bool)
-> (RPCMethod -> RPCMethod -> Bool) -> Eq RPCMethod
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RPCMethod -> RPCMethod -> Bool
== :: RPCMethod -> RPCMethod -> Bool
$c/= :: RPCMethod -> RPCMethod -> Bool
/= :: RPCMethod -> RPCMethod -> Bool
Eq, (forall x. RPCMethod -> Rep RPCMethod x)
-> (forall x. Rep RPCMethod x -> RPCMethod) -> Generic RPCMethod
forall x. Rep RPCMethod x -> RPCMethod
forall x. RPCMethod -> Rep RPCMethod x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. RPCMethod -> Rep RPCMethod x
from :: forall x. RPCMethod -> Rep RPCMethod x
$cto :: forall x. Rep RPCMethod x -> RPCMethod
to :: forall x. Rep RPCMethod x -> RPCMethod
Generic, Eq RPCMethod
Eq RPCMethod =>
(RPCMethod -> RPCMethod -> Ordering)
-> (RPCMethod -> RPCMethod -> Bool)
-> (RPCMethod -> RPCMethod -> Bool)
-> (RPCMethod -> RPCMethod -> Bool)
-> (RPCMethod -> RPCMethod -> Bool)
-> (RPCMethod -> RPCMethod -> RPCMethod)
-> (RPCMethod -> RPCMethod -> RPCMethod)
-> Ord RPCMethod
RPCMethod -> RPCMethod -> Bool
RPCMethod -> RPCMethod -> Ordering
RPCMethod -> RPCMethod -> RPCMethod
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: RPCMethod -> RPCMethod -> Ordering
compare :: RPCMethod -> RPCMethod -> Ordering
$c< :: RPCMethod -> RPCMethod -> Bool
< :: RPCMethod -> RPCMethod -> Bool
$c<= :: RPCMethod -> RPCMethod -> Bool
<= :: RPCMethod -> RPCMethod -> Bool
$c> :: RPCMethod -> RPCMethod -> Bool
> :: RPCMethod -> RPCMethod -> Bool
$c>= :: RPCMethod -> RPCMethod -> Bool
>= :: RPCMethod -> RPCMethod -> Bool
$cmax :: RPCMethod -> RPCMethod -> RPCMethod
max :: RPCMethod -> RPCMethod -> RPCMethod
$cmin :: RPCMethod -> RPCMethod -> RPCMethod
min :: RPCMethod -> RPCMethod -> RPCMethod
Ord, Int -> RPCMethod -> String -> String
[RPCMethod] -> String -> String
RPCMethod -> String
(Int -> RPCMethod -> String -> String)
-> (RPCMethod -> String)
-> ([RPCMethod] -> String -> String)
-> Show RPCMethod
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> RPCMethod -> String -> String
showsPrec :: Int -> RPCMethod -> String -> String
$cshow :: RPCMethod -> String
show :: RPCMethod -> String
$cshowList :: [RPCMethod] -> String -> String
showList :: [RPCMethod] -> String -> String
Show)

instance Arbitrary RPCMethod where
  arbitrary :: Gen RPCMethod
arbitrary = do
    DotProtoIdentifier
rpcMethodName <- Gen DotProtoIdentifier
arbitrarySingleIdentifier
    DotProtoIdentifier
rpcMethodRequestType <- Gen DotProtoIdentifier
arbitraryIdentifier
    Streaming
rpcMethodRequestStreaming  <- Gen Streaming
forall a. Arbitrary a => Gen a
arbitrary
    DotProtoIdentifier
rpcMethodResponseType <- Gen DotProtoIdentifier
arbitraryIdentifier
    Streaming
rpcMethodResponseStreaming  <- Gen Streaming
forall a. Arbitrary a => Gen a
arbitrary
    [DotProtoOption]
rpcMethodOptions <- Gen DotProtoOption -> Gen [DotProtoOption]
forall a. Gen a -> Gen [a]
smallListOf Gen DotProtoOption
forall a. Arbitrary a => Gen a
arbitrary
    RPCMethod -> Gen RPCMethod
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return RPCMethod{[DotProtoOption]
Streaming
DotProtoIdentifier
rpcMethodOptions :: [DotProtoOption]
rpcMethodResponseStreaming :: Streaming
rpcMethodResponseType :: DotProtoIdentifier
rpcMethodRequestStreaming :: Streaming
rpcMethodRequestType :: DotProtoIdentifier
rpcMethodName :: DotProtoIdentifier
rpcMethodName :: DotProtoIdentifier
rpcMethodRequestType :: DotProtoIdentifier
rpcMethodRequestStreaming :: Streaming
rpcMethodResponseType :: DotProtoIdentifier
rpcMethodResponseStreaming :: Streaming
rpcMethodOptions :: [DotProtoOption]
..}

data DotProtoMessagePart
  = DotProtoMessageField DotProtoField
  | DotProtoMessageOneOf DotProtoIdentifier [DotProtoField]
  | DotProtoMessageDefinition DotProtoDefinition
  | DotProtoMessageReserved   [DotProtoReservedField]
  | DotProtoMessageOption DotProtoOption
  deriving (Typeable DotProtoMessagePart
Typeable DotProtoMessagePart =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g)
 -> DotProtoMessagePart
 -> c DotProtoMessagePart)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c DotProtoMessagePart)
-> (DotProtoMessagePart -> Constr)
-> (DotProtoMessagePart -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c DotProtoMessagePart))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c DotProtoMessagePart))
-> ((forall b. Data b => b -> b)
    -> DotProtoMessagePart -> DotProtoMessagePart)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoMessagePart -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoMessagePart -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> DotProtoMessagePart -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> DotProtoMessagePart -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> DotProtoMessagePart -> m DotProtoMessagePart)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> DotProtoMessagePart -> m DotProtoMessagePart)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> DotProtoMessagePart -> m DotProtoMessagePart)
-> Data DotProtoMessagePart
DotProtoMessagePart -> Constr
DotProtoMessagePart -> DataType
(forall b. Data b => b -> b)
-> DotProtoMessagePart -> DotProtoMessagePart
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoMessagePart -> u
forall u.
(forall d. Data d => d -> u) -> DotProtoMessagePart -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoMessagePart -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoMessagePart -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoMessagePart -> m DotProtoMessagePart
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoMessagePart -> m DotProtoMessagePart
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoMessagePart
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> DotProtoMessagePart
-> c DotProtoMessagePart
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoMessagePart)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoMessagePart)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> DotProtoMessagePart
-> c DotProtoMessagePart
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> DotProtoMessagePart
-> c DotProtoMessagePart
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoMessagePart
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoMessagePart
$ctoConstr :: DotProtoMessagePart -> Constr
toConstr :: DotProtoMessagePart -> Constr
$cdataTypeOf :: DotProtoMessagePart -> DataType
dataTypeOf :: DotProtoMessagePart -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoMessagePart)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoMessagePart)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoMessagePart)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoMessagePart)
$cgmapT :: (forall b. Data b => b -> b)
-> DotProtoMessagePart -> DotProtoMessagePart
gmapT :: (forall b. Data b => b -> b)
-> DotProtoMessagePart -> DotProtoMessagePart
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoMessagePart -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoMessagePart -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoMessagePart -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoMessagePart -> r
$cgmapQ :: forall u.
(forall d. Data d => d -> u) -> DotProtoMessagePart -> [u]
gmapQ :: forall u.
(forall d. Data d => d -> u) -> DotProtoMessagePart -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoMessagePart -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoMessagePart -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoMessagePart -> m DotProtoMessagePart
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoMessagePart -> m DotProtoMessagePart
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoMessagePart -> m DotProtoMessagePart
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoMessagePart -> m DotProtoMessagePart
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoMessagePart -> m DotProtoMessagePart
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoMessagePart -> m DotProtoMessagePart
Data, DotProtoMessagePart -> DotProtoMessagePart -> Bool
(DotProtoMessagePart -> DotProtoMessagePart -> Bool)
-> (DotProtoMessagePart -> DotProtoMessagePart -> Bool)
-> Eq DotProtoMessagePart
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DotProtoMessagePart -> DotProtoMessagePart -> Bool
== :: DotProtoMessagePart -> DotProtoMessagePart -> Bool
$c/= :: DotProtoMessagePart -> DotProtoMessagePart -> Bool
/= :: DotProtoMessagePart -> DotProtoMessagePart -> Bool
Eq, (forall x. DotProtoMessagePart -> Rep DotProtoMessagePart x)
-> (forall x. Rep DotProtoMessagePart x -> DotProtoMessagePart)
-> Generic DotProtoMessagePart
forall x. Rep DotProtoMessagePart x -> DotProtoMessagePart
forall x. DotProtoMessagePart -> Rep DotProtoMessagePart x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. DotProtoMessagePart -> Rep DotProtoMessagePart x
from :: forall x. DotProtoMessagePart -> Rep DotProtoMessagePart x
$cto :: forall x. Rep DotProtoMessagePart x -> DotProtoMessagePart
to :: forall x. Rep DotProtoMessagePart x -> DotProtoMessagePart
Generic, Eq DotProtoMessagePart
Eq DotProtoMessagePart =>
(DotProtoMessagePart -> DotProtoMessagePart -> Ordering)
-> (DotProtoMessagePart -> DotProtoMessagePart -> Bool)
-> (DotProtoMessagePart -> DotProtoMessagePart -> Bool)
-> (DotProtoMessagePart -> DotProtoMessagePart -> Bool)
-> (DotProtoMessagePart -> DotProtoMessagePart -> Bool)
-> (DotProtoMessagePart
    -> DotProtoMessagePart -> DotProtoMessagePart)
-> (DotProtoMessagePart
    -> DotProtoMessagePart -> DotProtoMessagePart)
-> Ord DotProtoMessagePart
DotProtoMessagePart -> DotProtoMessagePart -> Bool
DotProtoMessagePart -> DotProtoMessagePart -> Ordering
DotProtoMessagePart -> DotProtoMessagePart -> DotProtoMessagePart
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: DotProtoMessagePart -> DotProtoMessagePart -> Ordering
compare :: DotProtoMessagePart -> DotProtoMessagePart -> Ordering
$c< :: DotProtoMessagePart -> DotProtoMessagePart -> Bool
< :: DotProtoMessagePart -> DotProtoMessagePart -> Bool
$c<= :: DotProtoMessagePart -> DotProtoMessagePart -> Bool
<= :: DotProtoMessagePart -> DotProtoMessagePart -> Bool
$c> :: DotProtoMessagePart -> DotProtoMessagePart -> Bool
> :: DotProtoMessagePart -> DotProtoMessagePart -> Bool
$c>= :: DotProtoMessagePart -> DotProtoMessagePart -> Bool
>= :: DotProtoMessagePart -> DotProtoMessagePart -> Bool
$cmax :: DotProtoMessagePart -> DotProtoMessagePart -> DotProtoMessagePart
max :: DotProtoMessagePart -> DotProtoMessagePart -> DotProtoMessagePart
$cmin :: DotProtoMessagePart -> DotProtoMessagePart -> DotProtoMessagePart
min :: DotProtoMessagePart -> DotProtoMessagePart -> DotProtoMessagePart
Ord, Int -> DotProtoMessagePart -> String -> String
[DotProtoMessagePart] -> String -> String
DotProtoMessagePart -> String
(Int -> DotProtoMessagePart -> String -> String)
-> (DotProtoMessagePart -> String)
-> ([DotProtoMessagePart] -> String -> String)
-> Show DotProtoMessagePart
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> DotProtoMessagePart -> String -> String
showsPrec :: Int -> DotProtoMessagePart -> String -> String
$cshow :: DotProtoMessagePart -> String
show :: DotProtoMessagePart -> String
$cshowList :: [DotProtoMessagePart] -> String -> String
showList :: [DotProtoMessagePart] -> String -> String
Show)

instance Arbitrary DotProtoMessagePart where
  arbitrary :: Gen DotProtoMessagePart
arbitrary = [Gen DotProtoMessagePart] -> Gen DotProtoMessagePart
forall a. HasCallStack => [Gen a] -> Gen a
oneof
    [ Gen DotProtoMessagePart
arbitraryField
    , Gen DotProtoMessagePart
arbitraryOneOf
    , Gen DotProtoMessagePart
arbitraryDefinition
    , Gen DotProtoMessagePart
arbitraryReserved
    ]
    where
      arbitraryField :: Gen DotProtoMessagePart
arbitraryField = do
        DotProtoField
field <- Gen DotProtoField
forall a. Arbitrary a => Gen a
arbitrary
        DotProtoMessagePart -> Gen DotProtoMessagePart
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return (DotProtoField -> DotProtoMessagePart
DotProtoMessageField DotProtoField
field)

      arbitraryOneOf :: Gen DotProtoMessagePart
arbitraryOneOf = do
        DotProtoIdentifier
name   <- Gen DotProtoIdentifier
arbitrarySingleIdentifier
        [DotProtoField]
fields <- Gen DotProtoField -> Gen [DotProtoField]
forall a. Gen a -> Gen [a]
smallListOf Gen DotProtoField
forall a. Arbitrary a => Gen a
arbitrary
        DotProtoMessagePart -> Gen DotProtoMessagePart
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return (DotProtoIdentifier -> [DotProtoField] -> DotProtoMessagePart
DotProtoMessageOneOf DotProtoIdentifier
name [DotProtoField]
fields)

      arbitraryDefinition :: Gen DotProtoMessagePart
arbitraryDefinition = do
        DotProtoDefinition
definition <- Gen DotProtoDefinition
forall a. Arbitrary a => Gen a
arbitrary
        DotProtoMessagePart -> Gen DotProtoMessagePart
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return (DotProtoDefinition -> DotProtoMessagePart
DotProtoMessageDefinition DotProtoDefinition
definition)

      arbitraryReserved :: Gen DotProtoMessagePart
arbitraryReserved = do
        [DotProtoReservedField]
fields <- [Gen [DotProtoReservedField]] -> Gen [DotProtoReservedField]
forall a. HasCallStack => [Gen a] -> Gen a
oneof [Gen DotProtoReservedField -> Gen [DotProtoReservedField]
forall a. Gen a -> Gen [a]
smallListOf1 Gen DotProtoReservedField
forall a. Arbitrary a => Gen a
arbitrary, Gen [DotProtoReservedField]
arbitraryReservedLabels]
        DotProtoMessagePart -> Gen DotProtoMessagePart
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return ([DotProtoReservedField] -> DotProtoMessagePart
DotProtoMessageReserved [DotProtoReservedField]
fields)

      arbitraryReservedLabels :: Gen [DotProtoReservedField]
      arbitraryReservedLabels :: Gen [DotProtoReservedField]
arbitraryReservedLabels =
          Gen DotProtoReservedField -> Gen [DotProtoReservedField]
forall a. Gen a -> Gen [a]
smallListOf1 (String -> DotProtoReservedField
ReservedIdentifier (String -> DotProtoReservedField)
-> Gen String -> Gen DotProtoReservedField
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen String
arbitraryIdentifierName)

data DotProtoField = DotProtoField
  { DotProtoField -> FieldNumber
dotProtoFieldNumber  :: FieldNumber
  , DotProtoField -> DotProtoType
dotProtoFieldType    :: DotProtoType
  , DotProtoField -> DotProtoIdentifier
dotProtoFieldName    :: DotProtoIdentifier
  , DotProtoField -> [DotProtoOption]
dotProtoFieldOptions :: [DotProtoOption]
  , DotProtoField -> String
dotProtoFieldComment :: String
  }
  deriving (Typeable DotProtoField
Typeable DotProtoField =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> DotProtoField -> c DotProtoField)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c DotProtoField)
-> (DotProtoField -> Constr)
-> (DotProtoField -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c DotProtoField))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c DotProtoField))
-> ((forall b. Data b => b -> b) -> DotProtoField -> DotProtoField)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoField -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> DotProtoField -> r)
-> (forall u. (forall d. Data d => d -> u) -> DotProtoField -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> DotProtoField -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> DotProtoField -> m DotProtoField)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> DotProtoField -> m DotProtoField)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> DotProtoField -> m DotProtoField)
-> Data DotProtoField
DotProtoField -> Constr
DotProtoField -> DataType
(forall b. Data b => b -> b) -> DotProtoField -> DotProtoField
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> DotProtoField -> u
forall u. (forall d. Data d => d -> u) -> DotProtoField -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoField -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoField -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DotProtoField -> m DotProtoField
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DotProtoField -> m DotProtoField
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoField
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProtoField -> c DotProtoField
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoField)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoField)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProtoField -> c DotProtoField
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DotProtoField -> c DotProtoField
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoField
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoField
$ctoConstr :: DotProtoField -> Constr
toConstr :: DotProtoField -> Constr
$cdataTypeOf :: DotProtoField -> DataType
dataTypeOf :: DotProtoField -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoField)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoField)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoField)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoField)
$cgmapT :: (forall b. Data b => b -> b) -> DotProtoField -> DotProtoField
gmapT :: (forall b. Data b => b -> b) -> DotProtoField -> DotProtoField
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoField -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoField -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoField -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoField -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> DotProtoField -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> DotProtoField -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> DotProtoField -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> DotProtoField -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DotProtoField -> m DotProtoField
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DotProtoField -> m DotProtoField
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DotProtoField -> m DotProtoField
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DotProtoField -> m DotProtoField
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DotProtoField -> m DotProtoField
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DotProtoField -> m DotProtoField
Data, DotProtoField -> DotProtoField -> Bool
(DotProtoField -> DotProtoField -> Bool)
-> (DotProtoField -> DotProtoField -> Bool) -> Eq DotProtoField
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DotProtoField -> DotProtoField -> Bool
== :: DotProtoField -> DotProtoField -> Bool
$c/= :: DotProtoField -> DotProtoField -> Bool
/= :: DotProtoField -> DotProtoField -> Bool
Eq, (forall x. DotProtoField -> Rep DotProtoField x)
-> (forall x. Rep DotProtoField x -> DotProtoField)
-> Generic DotProtoField
forall x. Rep DotProtoField x -> DotProtoField
forall x. DotProtoField -> Rep DotProtoField x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. DotProtoField -> Rep DotProtoField x
from :: forall x. DotProtoField -> Rep DotProtoField x
$cto :: forall x. Rep DotProtoField x -> DotProtoField
to :: forall x. Rep DotProtoField x -> DotProtoField
Generic, Eq DotProtoField
Eq DotProtoField =>
(DotProtoField -> DotProtoField -> Ordering)
-> (DotProtoField -> DotProtoField -> Bool)
-> (DotProtoField -> DotProtoField -> Bool)
-> (DotProtoField -> DotProtoField -> Bool)
-> (DotProtoField -> DotProtoField -> Bool)
-> (DotProtoField -> DotProtoField -> DotProtoField)
-> (DotProtoField -> DotProtoField -> DotProtoField)
-> Ord DotProtoField
DotProtoField -> DotProtoField -> Bool
DotProtoField -> DotProtoField -> Ordering
DotProtoField -> DotProtoField -> DotProtoField
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: DotProtoField -> DotProtoField -> Ordering
compare :: DotProtoField -> DotProtoField -> Ordering
$c< :: DotProtoField -> DotProtoField -> Bool
< :: DotProtoField -> DotProtoField -> Bool
$c<= :: DotProtoField -> DotProtoField -> Bool
<= :: DotProtoField -> DotProtoField -> Bool
$c> :: DotProtoField -> DotProtoField -> Bool
> :: DotProtoField -> DotProtoField -> Bool
$c>= :: DotProtoField -> DotProtoField -> Bool
>= :: DotProtoField -> DotProtoField -> Bool
$cmax :: DotProtoField -> DotProtoField -> DotProtoField
max :: DotProtoField -> DotProtoField -> DotProtoField
$cmin :: DotProtoField -> DotProtoField -> DotProtoField
min :: DotProtoField -> DotProtoField -> DotProtoField
Ord, Int -> DotProtoField -> String -> String
[DotProtoField] -> String -> String
DotProtoField -> String
(Int -> DotProtoField -> String -> String)
-> (DotProtoField -> String)
-> ([DotProtoField] -> String -> String)
-> Show DotProtoField
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> DotProtoField -> String -> String
showsPrec :: Int -> DotProtoField -> String -> String
$cshow :: DotProtoField -> String
show :: DotProtoField -> String
$cshowList :: [DotProtoField] -> String -> String
showList :: [DotProtoField] -> String -> String
Show)

instance Arbitrary DotProtoField where
  arbitrary :: Gen DotProtoField
arbitrary = do
    FieldNumber
dotProtoFieldNumber  <- Gen FieldNumber
forall a. Arbitrary a => Gen a
arbitrary
    DotProtoType
dotProtoFieldType    <- Gen DotProtoType
forall a. Arbitrary a => Gen a
arbitrary
    DotProtoIdentifier
dotProtoFieldName    <- Gen DotProtoIdentifier
arbitraryIdentifier
    [DotProtoOption]
dotProtoFieldOptions <- Gen DotProtoOption -> Gen [DotProtoOption]
forall a. Gen a -> Gen [a]
smallListOf Gen DotProtoOption
forall a. Arbitrary a => Gen a
arbitrary
    -- TODO: Generate random comments once the parser supports comments
    String
dotProtoFieldComment <- String -> Gen String
forall a. a -> Gen a
forall (f :: * -> *) a. Applicative f => a -> f a
pure String
forall a. Monoid a => a
mempty
    DotProtoField -> Gen DotProtoField
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return (DotProtoField {String
[DotProtoOption]
FieldNumber
DotProtoType
DotProtoIdentifier
dotProtoFieldNumber :: FieldNumber
dotProtoFieldType :: DotProtoType
dotProtoFieldName :: DotProtoIdentifier
dotProtoFieldOptions :: [DotProtoOption]
dotProtoFieldComment :: String
dotProtoFieldNumber :: FieldNumber
dotProtoFieldType :: DotProtoType
dotProtoFieldName :: DotProtoIdentifier
dotProtoFieldOptions :: [DotProtoOption]
dotProtoFieldComment :: String
..})

data DotProtoReservedField
  = SingleField Int
  | FieldRange  Int Int
  | ReservedIdentifier String
  deriving (Typeable DotProtoReservedField
Typeable DotProtoReservedField =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g)
 -> DotProtoReservedField
 -> c DotProtoReservedField)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c DotProtoReservedField)
-> (DotProtoReservedField -> Constr)
-> (DotProtoReservedField -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c DotProtoReservedField))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c DotProtoReservedField))
-> ((forall b. Data b => b -> b)
    -> DotProtoReservedField -> DotProtoReservedField)
-> (forall r r'.
    (r -> r' -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> DotProtoReservedField
    -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> DotProtoReservedField
    -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> DotProtoReservedField -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> DotProtoReservedField -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> DotProtoReservedField -> m DotProtoReservedField)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> DotProtoReservedField -> m DotProtoReservedField)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> DotProtoReservedField -> m DotProtoReservedField)
-> Data DotProtoReservedField
DotProtoReservedField -> Constr
DotProtoReservedField -> DataType
(forall b. Data b => b -> b)
-> DotProtoReservedField -> DotProtoReservedField
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoReservedField -> u
forall u.
(forall d. Data d => d -> u) -> DotProtoReservedField -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoReservedField -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoReservedField -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoReservedField -> m DotProtoReservedField
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoReservedField -> m DotProtoReservedField
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoReservedField
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> DotProtoReservedField
-> c DotProtoReservedField
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoReservedField)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoReservedField)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> DotProtoReservedField
-> c DotProtoReservedField
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> DotProtoReservedField
-> c DotProtoReservedField
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoReservedField
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DotProtoReservedField
$ctoConstr :: DotProtoReservedField -> Constr
toConstr :: DotProtoReservedField -> Constr
$cdataTypeOf :: DotProtoReservedField -> DataType
dataTypeOf :: DotProtoReservedField -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoReservedField)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DotProtoReservedField)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoReservedField)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DotProtoReservedField)
$cgmapT :: (forall b. Data b => b -> b)
-> DotProtoReservedField -> DotProtoReservedField
gmapT :: (forall b. Data b => b -> b)
-> DotProtoReservedField -> DotProtoReservedField
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoReservedField -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoReservedField -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoReservedField -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DotProtoReservedField -> r
$cgmapQ :: forall u.
(forall d. Data d => d -> u) -> DotProtoReservedField -> [u]
gmapQ :: forall u.
(forall d. Data d => d -> u) -> DotProtoReservedField -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoReservedField -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> DotProtoReservedField -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoReservedField -> m DotProtoReservedField
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DotProtoReservedField -> m DotProtoReservedField
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoReservedField -> m DotProtoReservedField
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoReservedField -> m DotProtoReservedField
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoReservedField -> m DotProtoReservedField
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DotProtoReservedField -> m DotProtoReservedField
Data, DotProtoReservedField -> DotProtoReservedField -> Bool
(DotProtoReservedField -> DotProtoReservedField -> Bool)
-> (DotProtoReservedField -> DotProtoReservedField -> Bool)
-> Eq DotProtoReservedField
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DotProtoReservedField -> DotProtoReservedField -> Bool
== :: DotProtoReservedField -> DotProtoReservedField -> Bool
$c/= :: DotProtoReservedField -> DotProtoReservedField -> Bool
/= :: DotProtoReservedField -> DotProtoReservedField -> Bool
Eq, (forall x. DotProtoReservedField -> Rep DotProtoReservedField x)
-> (forall x. Rep DotProtoReservedField x -> DotProtoReservedField)
-> Generic DotProtoReservedField
forall x. Rep DotProtoReservedField x -> DotProtoReservedField
forall x. DotProtoReservedField -> Rep DotProtoReservedField x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. DotProtoReservedField -> Rep DotProtoReservedField x
from :: forall x. DotProtoReservedField -> Rep DotProtoReservedField x
$cto :: forall x. Rep DotProtoReservedField x -> DotProtoReservedField
to :: forall x. Rep DotProtoReservedField x -> DotProtoReservedField
Generic, Eq DotProtoReservedField
Eq DotProtoReservedField =>
(DotProtoReservedField -> DotProtoReservedField -> Ordering)
-> (DotProtoReservedField -> DotProtoReservedField -> Bool)
-> (DotProtoReservedField -> DotProtoReservedField -> Bool)
-> (DotProtoReservedField -> DotProtoReservedField -> Bool)
-> (DotProtoReservedField -> DotProtoReservedField -> Bool)
-> (DotProtoReservedField
    -> DotProtoReservedField -> DotProtoReservedField)
-> (DotProtoReservedField
    -> DotProtoReservedField -> DotProtoReservedField)
-> Ord DotProtoReservedField
DotProtoReservedField -> DotProtoReservedField -> Bool
DotProtoReservedField -> DotProtoReservedField -> Ordering
DotProtoReservedField
-> DotProtoReservedField -> DotProtoReservedField
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: DotProtoReservedField -> DotProtoReservedField -> Ordering
compare :: DotProtoReservedField -> DotProtoReservedField -> Ordering
$c< :: DotProtoReservedField -> DotProtoReservedField -> Bool
< :: DotProtoReservedField -> DotProtoReservedField -> Bool
$c<= :: DotProtoReservedField -> DotProtoReservedField -> Bool
<= :: DotProtoReservedField -> DotProtoReservedField -> Bool
$c> :: DotProtoReservedField -> DotProtoReservedField -> Bool
> :: DotProtoReservedField -> DotProtoReservedField -> Bool
$c>= :: DotProtoReservedField -> DotProtoReservedField -> Bool
>= :: DotProtoReservedField -> DotProtoReservedField -> Bool
$cmax :: DotProtoReservedField
-> DotProtoReservedField -> DotProtoReservedField
max :: DotProtoReservedField
-> DotProtoReservedField -> DotProtoReservedField
$cmin :: DotProtoReservedField
-> DotProtoReservedField -> DotProtoReservedField
min :: DotProtoReservedField
-> DotProtoReservedField -> DotProtoReservedField
Ord, Int -> DotProtoReservedField -> String -> String
[DotProtoReservedField] -> String -> String
DotProtoReservedField -> String
(Int -> DotProtoReservedField -> String -> String)
-> (DotProtoReservedField -> String)
-> ([DotProtoReservedField] -> String -> String)
-> Show DotProtoReservedField
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> DotProtoReservedField -> String -> String
showsPrec :: Int -> DotProtoReservedField -> String -> String
$cshow :: DotProtoReservedField -> String
show :: DotProtoReservedField -> String
$cshowList :: [DotProtoReservedField] -> String -> String
showList :: [DotProtoReservedField] -> String -> String
Show)

instance Pretty DotProtoReservedField where
  pPrint :: DotProtoReservedField -> Doc
pPrint (SingleField Int
num)      = String -> Doc
PP.text (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ Int -> String
forall a. Show a => a -> String
show Int
num
  pPrint (FieldRange Int
start Int
end) = (String -> Doc
PP.text (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ Int -> String
forall a. Show a => a -> String
show Int
start) Doc -> Doc -> Doc
<+> String -> Doc
PP.text String
"to" Doc -> Doc -> Doc
<+> (String -> Doc
PP.text (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ Int -> String
forall a. Show a => a -> String
show Int
end)
  pPrint (ReservedIdentifier String
i) = String -> Doc
PP.text (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ String -> String
forall a. Show a => a -> String
show String
i

instance Arbitrary DotProtoReservedField where
  arbitrary :: Gen DotProtoReservedField
arbitrary =
    [Gen DotProtoReservedField] -> Gen DotProtoReservedField
forall a. HasCallStack => [Gen a] -> Gen a
oneof [Gen DotProtoReservedField
arbitrarySingleField, Gen DotProtoReservedField
arbitraryFieldRange]
      where
        arbitraryFieldNumber :: Gen Int
arbitraryFieldNumber = do
          Natural
natural <- Gen Natural
forall a. Arbitrary a => Gen a
arbitrary
          Int -> Gen Int
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return (Natural -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Natural
natural :: Natural))

        arbitrarySingleField :: Gen DotProtoReservedField
arbitrarySingleField = do
          Int
fieldNumber <- Gen Int
arbitraryFieldNumber
          DotProtoReservedField -> Gen DotProtoReservedField
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> DotProtoReservedField
SingleField Int
fieldNumber)

        arbitraryFieldRange :: Gen DotProtoReservedField
arbitraryFieldRange = do
          Int
begin <- Gen Int
arbitraryFieldNumber
          Int
end   <- Gen Int
arbitraryFieldNumber
          DotProtoReservedField -> Gen DotProtoReservedField
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> Int -> DotProtoReservedField
FieldRange Int
begin Int
end)

--------------------------------------------------------------------------------
-- | QC Arbitrary instance for generating random protobuf

_arbitraryService :: Gen DotProtoDefinition
_arbitraryService :: Gen DotProtoDefinition
_arbitraryService = do
  String
comment    <- String -> Gen String
forall a. a -> Gen a
forall (f :: * -> *) a. Applicative f => a -> f a
pure String
forall a. Monoid a => a
mempty  -- until parser supports comments
  DotProtoIdentifier
identifier <- Gen DotProtoIdentifier
arbitrarySingleIdentifier
  [DotProtoServicePart]
parts      <- Gen DotProtoServicePart -> Gen [DotProtoServicePart]
forall a. Gen a -> Gen [a]
smallListOf Gen DotProtoServicePart
forall a. Arbitrary a => Gen a
arbitrary
  DotProtoDefinition -> Gen DotProtoDefinition
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return (String
-> DotProtoIdentifier
-> [DotProtoServicePart]
-> DotProtoDefinition
DotProtoService String
comment DotProtoIdentifier
identifier [DotProtoServicePart]
parts)

arbitraryIdentifierName :: Gen String
arbitraryIdentifierName :: Gen String
arbitraryIdentifierName = do
  Char
c  <- String -> Gen Char
forall a. HasCallStack => [a] -> Gen a
elements ([Char
'a'..Char
'z'] String -> String -> String
forall a. [a] -> [a] -> [a]
++ [Char
'A'..Char
'Z'])
  String
cs <- Gen Char -> Gen String
forall a. Gen a -> Gen [a]
smallListOf (String -> Gen Char
forall a. HasCallStack => [a] -> Gen a
elements ([Char
'a'..Char
'z'] String -> String -> String
forall a. [a] -> [a] -> [a]
++ [Char
'A'..Char
'Z'] String -> String -> String
forall a. [a] -> [a] -> [a]
++ [Char
'_']))
  String -> Gen String
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return (Char
cChar -> String -> String
forall a. a -> [a] -> [a]
:String
cs)

arbitrarySingleIdentifier :: Gen DotProtoIdentifier
arbitrarySingleIdentifier :: Gen DotProtoIdentifier
arbitrarySingleIdentifier = (String -> DotProtoIdentifier)
-> Gen String -> Gen DotProtoIdentifier
forall a b. (a -> b) -> Gen a -> Gen b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> DotProtoIdentifier
Single Gen String
arbitraryIdentifierName

arbitraryPathIdentifier :: Gen DotProtoIdentifier
arbitraryPathIdentifier :: Gen DotProtoIdentifier
arbitraryPathIdentifier = do
  String
name  <- Gen String
arbitraryIdentifierName
  [String]
names <- Gen String -> Gen [String]
forall a. Gen a -> Gen [a]
smallListOf1 Gen String
arbitraryIdentifierName
  DotProtoIdentifier -> Gen DotProtoIdentifier
forall a. a -> Gen a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (DotProtoIdentifier -> Gen DotProtoIdentifier)
-> (NonEmpty String -> DotProtoIdentifier)
-> NonEmpty String
-> Gen DotProtoIdentifier
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Path -> DotProtoIdentifier
Dots (Path -> DotProtoIdentifier)
-> (NonEmpty String -> Path)
-> NonEmpty String
-> DotProtoIdentifier
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmpty String -> Path
Path (NonEmpty String -> Gen DotProtoIdentifier)
-> NonEmpty String -> Gen DotProtoIdentifier
forall a b. (a -> b) -> a -> b
$ String
name String -> [String] -> NonEmpty String
forall a. a -> [a] -> NonEmpty a
NE.:| [String]
names

arbitraryNestedIdentifier :: Gen DotProtoIdentifier
arbitraryNestedIdentifier :: Gen DotProtoIdentifier
arbitraryNestedIdentifier = do
  DotProtoIdentifier
identifier0 <- Gen DotProtoIdentifier
arbitraryIdentifier
  DotProtoIdentifier
identifier1 <- Gen DotProtoIdentifier
arbitrarySingleIdentifier
  DotProtoIdentifier -> Gen DotProtoIdentifier
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return (DotProtoIdentifier -> DotProtoIdentifier -> DotProtoIdentifier
Qualified DotProtoIdentifier
identifier0 DotProtoIdentifier
identifier1)

-- these two kinds of identifiers are usually interchangeable, the others are not
arbitraryIdentifier :: Gen DotProtoIdentifier
arbitraryIdentifier :: Gen DotProtoIdentifier
arbitraryIdentifier = [Gen DotProtoIdentifier] -> Gen DotProtoIdentifier
forall a. HasCallStack => [Gen a] -> Gen a
oneof [Gen DotProtoIdentifier
arbitrarySingleIdentifier, Gen DotProtoIdentifier
arbitraryPathIdentifier]

-- [note] quickcheck's default scaling generates *extremely* large asts past 20 iterations
--        the parser is not particularly slow but it does have noticeable delay on megabyte-large .proto files
smallListOf :: Gen a -> Gen [a]
smallListOf :: forall a. Gen a -> Gen [a]
smallListOf Gen a
x = (Int, Int) -> Gen Int
forall a. Random a => (a, a) -> Gen a
choose (Int
0, Int
5) Gen Int -> (Int -> Gen [a]) -> Gen [a]
forall a b. Gen a -> (a -> Gen b) -> Gen b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Int
n -> Int -> Gen a -> Gen [a]
forall a. Int -> Gen a -> Gen [a]
vectorOf Int
n Gen a
x

smallListOf1 :: Gen a -> Gen [a]
smallListOf1 :: forall a. Gen a -> Gen [a]
smallListOf1 Gen a
x = (Int, Int) -> Gen Int
forall a. Random a => (a, a) -> Gen a
choose (Int
1, Int
5) Gen Int -> (Int -> Gen [a]) -> Gen [a]
forall a b. Gen a -> (a -> Gen b) -> Gen b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Int
n -> Int -> Gen a -> Gen [a]
forall a. Int -> Gen a -> Gen [a]
vectorOf Int
n Gen a
x

strLit :: String -> PP.Doc
strLit :: String -> Doc
strLit String
string = String -> Doc
PP.text String
"\"" Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> (Char -> Doc) -> String -> Doc
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Char -> Doc
escape String
string Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
PP.text String
"\""
  where
    escape :: Char -> Doc
escape Char
'\n' = String -> Doc
PP.text String
"\\n"
    escape Char
'\\' = String -> Doc
PP.text String
"\\\\"
    escape Char
'\0' = String -> Doc
PP.text String
"\\x00"
    escape Char
'"'  = String -> Doc
PP.text String
"\\\""
    escape  Char
c   = String -> Doc
PP.text [ Char
c ]

serviceOption :: DotProtoOption -> PP.Doc
serviceOption :: DotProtoOption -> Doc
serviceOption DotProtoOption
o = String -> Doc
PP.text String
"option" Doc -> Doc -> Doc
<+> DotProtoOption -> Doc
forall a. Pretty a => a -> Doc
pPrint DotProtoOption
o Doc -> Doc -> Doc
PP.<> String -> Doc
PP.text String
";"