{-# LANGUAGE DeriveDataTypeable         #-}
{-# LANGUAGE DeriveGeneric              #-}
{-# LANGUAGE DeriveLift                 #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}

{-
  Copyright 2016 Awake Networks

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-}

-- | This module defines types which are shared by the encoding and decoding
-- modules.

module Proto3.Wire.Types
    ( -- * Message Structure
      FieldNumber(..)
    , fieldNumber
    , WireType(..)
    ) where

import           Control.DeepSeq            ( NFData )
import           Data.Data                  ( Data )
import           Data.Hashable              ( Hashable )
import           Data.Word                  ( Word64 )
import           GHC.Generics               ( Generic )
import           Language.Haskell.TH.Syntax ( Lift )
import           Test.QuickCheck            ( Arbitrary(..), choose )

-- | A 'FieldNumber' identifies a field inside a protobufs message.
--
-- This library makes no attempt to generate these automatically, or even make
-- sure that field numbers are provided in increasing order. Such things are
-- left to other, higher-level libraries.
newtype FieldNumber = FieldNumber
  { FieldNumber -> Word64
getFieldNumber :: Word64 }
  deriving (FieldNumber
FieldNumber -> FieldNumber -> Bounded FieldNumber
forall a. a -> a -> Bounded a
$cminBound :: FieldNumber
minBound :: FieldNumber
$cmaxBound :: FieldNumber
maxBound :: FieldNumber
Bounded, Typeable FieldNumber
Typeable FieldNumber =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> FieldNumber -> c FieldNumber)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c FieldNumber)
-> (FieldNumber -> Constr)
-> (FieldNumber -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c FieldNumber))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c FieldNumber))
-> ((forall b. Data b => b -> b) -> FieldNumber -> FieldNumber)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> FieldNumber -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> FieldNumber -> r)
-> (forall u. (forall d. Data d => d -> u) -> FieldNumber -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> FieldNumber -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> FieldNumber -> m FieldNumber)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> FieldNumber -> m FieldNumber)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> FieldNumber -> m FieldNumber)
-> Data FieldNumber
FieldNumber -> Constr
FieldNumber -> DataType
(forall b. Data b => b -> b) -> FieldNumber -> FieldNumber
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) -> FieldNumber -> u
forall u. (forall d. Data d => d -> u) -> FieldNumber -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FieldNumber -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FieldNumber -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FieldNumber -> m FieldNumber
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FieldNumber -> m FieldNumber
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FieldNumber
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FieldNumber -> c FieldNumber
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FieldNumber)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FieldNumber)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FieldNumber -> c FieldNumber
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FieldNumber -> c FieldNumber
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FieldNumber
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FieldNumber
$ctoConstr :: FieldNumber -> Constr
toConstr :: FieldNumber -> Constr
$cdataTypeOf :: FieldNumber -> DataType
dataTypeOf :: FieldNumber -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FieldNumber)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FieldNumber)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FieldNumber)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FieldNumber)
$cgmapT :: (forall b. Data b => b -> b) -> FieldNumber -> FieldNumber
gmapT :: (forall b. Data b => b -> b) -> FieldNumber -> FieldNumber
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FieldNumber -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FieldNumber -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FieldNumber -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FieldNumber -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FieldNumber -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> FieldNumber -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FieldNumber -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FieldNumber -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FieldNumber -> m FieldNumber
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FieldNumber -> m FieldNumber
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FieldNumber -> m FieldNumber
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FieldNumber -> m FieldNumber
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FieldNumber -> m FieldNumber
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FieldNumber -> m FieldNumber
Data, Int -> FieldNumber
FieldNumber -> Int
FieldNumber -> [FieldNumber]
FieldNumber -> FieldNumber
FieldNumber -> FieldNumber -> [FieldNumber]
FieldNumber -> FieldNumber -> FieldNumber -> [FieldNumber]
(FieldNumber -> FieldNumber)
-> (FieldNumber -> FieldNumber)
-> (Int -> FieldNumber)
-> (FieldNumber -> Int)
-> (FieldNumber -> [FieldNumber])
-> (FieldNumber -> FieldNumber -> [FieldNumber])
-> (FieldNumber -> FieldNumber -> [FieldNumber])
-> (FieldNumber -> FieldNumber -> FieldNumber -> [FieldNumber])
-> Enum FieldNumber
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 :: FieldNumber -> FieldNumber
succ :: FieldNumber -> FieldNumber
$cpred :: FieldNumber -> FieldNumber
pred :: FieldNumber -> FieldNumber
$ctoEnum :: Int -> FieldNumber
toEnum :: Int -> FieldNumber
$cfromEnum :: FieldNumber -> Int
fromEnum :: FieldNumber -> Int
$cenumFrom :: FieldNumber -> [FieldNumber]
enumFrom :: FieldNumber -> [FieldNumber]
$cenumFromThen :: FieldNumber -> FieldNumber -> [FieldNumber]
enumFromThen :: FieldNumber -> FieldNumber -> [FieldNumber]
$cenumFromTo :: FieldNumber -> FieldNumber -> [FieldNumber]
enumFromTo :: FieldNumber -> FieldNumber -> [FieldNumber]
$cenumFromThenTo :: FieldNumber -> FieldNumber -> FieldNumber -> [FieldNumber]
enumFromThenTo :: FieldNumber -> FieldNumber -> FieldNumber -> [FieldNumber]
Enum, FieldNumber -> FieldNumber -> Bool
(FieldNumber -> FieldNumber -> Bool)
-> (FieldNumber -> FieldNumber -> Bool) -> Eq FieldNumber
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FieldNumber -> FieldNumber -> Bool
== :: FieldNumber -> FieldNumber -> Bool
$c/= :: FieldNumber -> FieldNumber -> Bool
/= :: FieldNumber -> FieldNumber -> Bool
Eq, (forall x. FieldNumber -> Rep FieldNumber x)
-> (forall x. Rep FieldNumber x -> FieldNumber)
-> Generic FieldNumber
forall x. Rep FieldNumber x -> FieldNumber
forall x. FieldNumber -> Rep FieldNumber x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FieldNumber -> Rep FieldNumber x
from :: forall x. FieldNumber -> Rep FieldNumber x
$cto :: forall x. Rep FieldNumber x -> FieldNumber
to :: forall x. Rep FieldNumber x -> FieldNumber
Generic, Eq FieldNumber
Eq FieldNumber =>
(Int -> FieldNumber -> Int)
-> (FieldNumber -> Int) -> Hashable FieldNumber
Int -> FieldNumber -> Int
FieldNumber -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> FieldNumber -> Int
hashWithSalt :: Int -> FieldNumber -> Int
$chash :: FieldNumber -> Int
hash :: FieldNumber -> Int
Hashable, (forall (m :: * -> *). Quote m => FieldNumber -> m Exp)
-> (forall (m :: * -> *).
    Quote m =>
    FieldNumber -> Code m FieldNumber)
-> Lift FieldNumber
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => FieldNumber -> m Exp
forall (m :: * -> *). Quote m => FieldNumber -> Code m FieldNumber
$clift :: forall (m :: * -> *). Quote m => FieldNumber -> m Exp
lift :: forall (m :: * -> *). Quote m => FieldNumber -> m Exp
$cliftTyped :: forall (m :: * -> *). Quote m => FieldNumber -> Code m FieldNumber
liftTyped :: forall (m :: * -> *). Quote m => FieldNumber -> Code m FieldNumber
Lift, FieldNumber -> ()
(FieldNumber -> ()) -> NFData FieldNumber
forall a. (a -> ()) -> NFData a
$crnf :: FieldNumber -> ()
rnf :: FieldNumber -> ()
NFData, Integer -> FieldNumber
FieldNumber -> FieldNumber
FieldNumber -> FieldNumber -> FieldNumber
(FieldNumber -> FieldNumber -> FieldNumber)
-> (FieldNumber -> FieldNumber -> FieldNumber)
-> (FieldNumber -> FieldNumber -> FieldNumber)
-> (FieldNumber -> FieldNumber)
-> (FieldNumber -> FieldNumber)
-> (FieldNumber -> FieldNumber)
-> (Integer -> FieldNumber)
-> Num FieldNumber
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
$c+ :: FieldNumber -> FieldNumber -> FieldNumber
+ :: FieldNumber -> FieldNumber -> FieldNumber
$c- :: FieldNumber -> FieldNumber -> FieldNumber
- :: FieldNumber -> FieldNumber -> FieldNumber
$c* :: FieldNumber -> FieldNumber -> FieldNumber
* :: FieldNumber -> FieldNumber -> FieldNumber
$cnegate :: FieldNumber -> FieldNumber
negate :: FieldNumber -> FieldNumber
$cabs :: FieldNumber -> FieldNumber
abs :: FieldNumber -> FieldNumber
$csignum :: FieldNumber -> FieldNumber
signum :: FieldNumber -> FieldNumber
$cfromInteger :: Integer -> FieldNumber
fromInteger :: Integer -> FieldNumber
Num, Eq FieldNumber
Eq FieldNumber =>
(FieldNumber -> FieldNumber -> Ordering)
-> (FieldNumber -> FieldNumber -> Bool)
-> (FieldNumber -> FieldNumber -> Bool)
-> (FieldNumber -> FieldNumber -> Bool)
-> (FieldNumber -> FieldNumber -> Bool)
-> (FieldNumber -> FieldNumber -> FieldNumber)
-> (FieldNumber -> FieldNumber -> FieldNumber)
-> Ord FieldNumber
FieldNumber -> FieldNumber -> Bool
FieldNumber -> FieldNumber -> Ordering
FieldNumber -> FieldNumber -> FieldNumber
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 :: FieldNumber -> FieldNumber -> Ordering
compare :: FieldNumber -> FieldNumber -> Ordering
$c< :: FieldNumber -> FieldNumber -> Bool
< :: FieldNumber -> FieldNumber -> Bool
$c<= :: FieldNumber -> FieldNumber -> Bool
<= :: FieldNumber -> FieldNumber -> Bool
$c> :: FieldNumber -> FieldNumber -> Bool
> :: FieldNumber -> FieldNumber -> Bool
$c>= :: FieldNumber -> FieldNumber -> Bool
>= :: FieldNumber -> FieldNumber -> Bool
$cmax :: FieldNumber -> FieldNumber -> FieldNumber
max :: FieldNumber -> FieldNumber -> FieldNumber
$cmin :: FieldNumber -> FieldNumber -> FieldNumber
min :: FieldNumber -> FieldNumber -> FieldNumber
Ord)

instance Show FieldNumber where
  show :: FieldNumber -> String
show (FieldNumber Word64
n) = Word64 -> String
forall a. Show a => a -> String
show Word64
n

instance Arbitrary FieldNumber where
  arbitrary :: Gen FieldNumber
arbitrary = Word64 -> FieldNumber
FieldNumber (Word64 -> FieldNumber) -> Gen Word64 -> Gen FieldNumber
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Word64, Word64) -> Gen Word64
forall a. Random a => (a, a) -> Gen a
choose (Word64
1, Word64
536870911)

-- | Create a 'FieldNumber' given the (one-based) integer which would label
-- the field in the corresponding .proto file.
fieldNumber :: Word64 -> FieldNumber
fieldNumber :: Word64 -> FieldNumber
fieldNumber = Word64 -> FieldNumber
FieldNumber

-- | The (non-deprecated) wire types identified by the Protocol
-- Buffers specification.
data WireType
  = Varint
  | Fixed32
  | Fixed64
  | LengthDelimited
  deriving (WireType
WireType -> WireType -> Bounded WireType
forall a. a -> a -> Bounded a
$cminBound :: WireType
minBound :: WireType
$cmaxBound :: WireType
maxBound :: WireType
Bounded, Typeable WireType
Typeable WireType =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> WireType -> c WireType)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c WireType)
-> (WireType -> Constr)
-> (WireType -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c WireType))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c WireType))
-> ((forall b. Data b => b -> b) -> WireType -> WireType)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> WireType -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> WireType -> r)
-> (forall u. (forall d. Data d => d -> u) -> WireType -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> WireType -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> WireType -> m WireType)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> WireType -> m WireType)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> WireType -> m WireType)
-> Data WireType
WireType -> Constr
WireType -> DataType
(forall b. Data b => b -> b) -> WireType -> WireType
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) -> WireType -> u
forall u. (forall d. Data d => d -> u) -> WireType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WireType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WireType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> WireType -> m WireType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> WireType -> m WireType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c WireType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WireType -> c WireType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c WireType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c WireType)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WireType -> c WireType
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WireType -> c WireType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c WireType
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c WireType
$ctoConstr :: WireType -> Constr
toConstr :: WireType -> Constr
$cdataTypeOf :: WireType -> DataType
dataTypeOf :: WireType -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c WireType)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c WireType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c WireType)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c WireType)
$cgmapT :: (forall b. Data b => b -> b) -> WireType -> WireType
gmapT :: (forall b. Data b => b -> b) -> WireType -> WireType
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WireType -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WireType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WireType -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WireType -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> WireType -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> WireType -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> WireType -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> WireType -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> WireType -> m WireType
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> WireType -> m WireType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> WireType -> m WireType
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> WireType -> m WireType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> WireType -> m WireType
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> WireType -> m WireType
Data, Int -> WireType
WireType -> Int
WireType -> [WireType]
WireType -> WireType
WireType -> WireType -> [WireType]
WireType -> WireType -> WireType -> [WireType]
(WireType -> WireType)
-> (WireType -> WireType)
-> (Int -> WireType)
-> (WireType -> Int)
-> (WireType -> [WireType])
-> (WireType -> WireType -> [WireType])
-> (WireType -> WireType -> [WireType])
-> (WireType -> WireType -> WireType -> [WireType])
-> Enum WireType
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 :: WireType -> WireType
succ :: WireType -> WireType
$cpred :: WireType -> WireType
pred :: WireType -> WireType
$ctoEnum :: Int -> WireType
toEnum :: Int -> WireType
$cfromEnum :: WireType -> Int
fromEnum :: WireType -> Int
$cenumFrom :: WireType -> [WireType]
enumFrom :: WireType -> [WireType]
$cenumFromThen :: WireType -> WireType -> [WireType]
enumFromThen :: WireType -> WireType -> [WireType]
$cenumFromTo :: WireType -> WireType -> [WireType]
enumFromTo :: WireType -> WireType -> [WireType]
$cenumFromThenTo :: WireType -> WireType -> WireType -> [WireType]
enumFromThenTo :: WireType -> WireType -> WireType -> [WireType]
Enum, WireType -> WireType -> Bool
(WireType -> WireType -> Bool)
-> (WireType -> WireType -> Bool) -> Eq WireType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: WireType -> WireType -> Bool
== :: WireType -> WireType -> Bool
$c/= :: WireType -> WireType -> Bool
/= :: WireType -> WireType -> Bool
Eq, (forall x. WireType -> Rep WireType x)
-> (forall x. Rep WireType x -> WireType) -> Generic WireType
forall x. Rep WireType x -> WireType
forall x. WireType -> Rep WireType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. WireType -> Rep WireType x
from :: forall x. WireType -> Rep WireType x
$cto :: forall x. Rep WireType x -> WireType
to :: forall x. Rep WireType x -> WireType
Generic, (forall (m :: * -> *). Quote m => WireType -> m Exp)
-> (forall (m :: * -> *). Quote m => WireType -> Code m WireType)
-> Lift WireType
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => WireType -> m Exp
forall (m :: * -> *). Quote m => WireType -> Code m WireType
$clift :: forall (m :: * -> *). Quote m => WireType -> m Exp
lift :: forall (m :: * -> *). Quote m => WireType -> m Exp
$cliftTyped :: forall (m :: * -> *). Quote m => WireType -> Code m WireType
liftTyped :: forall (m :: * -> *). Quote m => WireType -> Code m WireType
Lift, Eq WireType
Eq WireType =>
(WireType -> WireType -> Ordering)
-> (WireType -> WireType -> Bool)
-> (WireType -> WireType -> Bool)
-> (WireType -> WireType -> Bool)
-> (WireType -> WireType -> Bool)
-> (WireType -> WireType -> WireType)
-> (WireType -> WireType -> WireType)
-> Ord WireType
WireType -> WireType -> Bool
WireType -> WireType -> Ordering
WireType -> WireType -> WireType
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 :: WireType -> WireType -> Ordering
compare :: WireType -> WireType -> Ordering
$c< :: WireType -> WireType -> Bool
< :: WireType -> WireType -> Bool
$c<= :: WireType -> WireType -> Bool
<= :: WireType -> WireType -> Bool
$c> :: WireType -> WireType -> Bool
> :: WireType -> WireType -> Bool
$c>= :: WireType -> WireType -> Bool
>= :: WireType -> WireType -> Bool
$cmax :: WireType -> WireType -> WireType
max :: WireType -> WireType -> WireType
$cmin :: WireType -> WireType -> WireType
min :: WireType -> WireType -> WireType
Ord, Int -> WireType -> ShowS
[WireType] -> ShowS
WireType -> String
(Int -> WireType -> ShowS)
-> (WireType -> String) -> ([WireType] -> ShowS) -> Show WireType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> WireType -> ShowS
showsPrec :: Int -> WireType -> ShowS
$cshow :: WireType -> String
show :: WireType -> String
$cshowList :: [WireType] -> ShowS
showList :: [WireType] -> ShowS
Show)