pinch-0.3.2.0: An alternative implementation of Thrift for Haskell.

Copyright(c) Abhinav Gupta 2015
LicenseBSD3
MaintainerAbhinav Gupta <mail@abhinavg.net>
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell2010

Pinch.Internal.TType

Contents

Description

Defines the different types Thrift supports at the protocol level.

Synopsis

TType

data TType a where #

Represents the type of a Thrift value.

Objects of this type are tagged with one of the TType tags, so this type also acts as a singleton on the TTypes. It allows writing code that can enforce properties about the TType of values at compile time.

Instances

Eq (TType a) # 

Methods

(==) :: TType a -> TType a -> Bool #

(/=) :: TType a -> TType a -> Bool #

Show (TType a) # 

Methods

showsPrec :: Int -> TType a -> ShowS #

show :: TType a -> String #

showList :: [TType a] -> ShowS #

Hashable (TType a) # 

Methods

hashWithSalt :: Int -> TType a -> Int #

hash :: TType a -> Int #

class Typeable a => IsTType a where #

Typeclass used to map type-leve TTypes into TType objects. All TType tags are instances of this class.

Minimal complete definition

ttype

Methods

ttype :: TType a #

Based on the context in which this is used, it will automatically return the corresponding TType object.

data SomeTType where #

Used when the TType for something is not known at compile time. Typically, this will be pattern matched inside a case statement and code that depends on the TType will be go there.

Constructors

SomeTType :: forall a. IsTType a => TType a -> SomeTType 

ttypeEquality :: TType a -> TType b -> Maybe (a :~: b) #

Witness the equality of two ttypes.

ttypeEqT :: forall a b. (IsTType a, IsTType b) => Maybe (a :~: b) #

Witness the equality of two TTypes.

Implicit version of ttypeEquality.

Tags

data TBool #

bool

Instances

data TByte #

byte

Instances

data TDouble #

double

Instances

data TInt16 #

i16

Instances

data TInt32 #

i32

Instances

type TEnum = TInt32 #

enum

data TInt64 #

i64

Instances

data TBinary #

binary

Instances

type TText = TBinary #

string

data TStruct #

struct

Instances

type TUnion = TStruct #

union

type TException = TStruct #

exception

data TMap #

map<k, v>

Instances

IsTType TMap # 

Methods

ttype :: TType TMap #

data TSet #

set<x>

Instances

IsTType TSet # 

Methods

ttype :: TType TSet #

data TList #

list<x>

Instances