language-thrift 0.3.0.0 → 0.4.0.0
raw patch · 9 files changed
+659/−50 lines, 9 filesdep +QuickCheckdep +hspecdep +hspec-discoverdep ~basedep ~textdep ~trifectaPVP ok
version bump matches the API change (PVP)
Dependencies added: QuickCheck, hspec, hspec-discover, language-thrift, wl-pprint
Dependency ranges changed: base, text, trifecta
API changes (from Hackage documentation)
- Language.Thrift.Parser: constant :: (TokenParsing p, MonadPlus p) => ThriftParser p n (Definition n)
- Language.Thrift.Parser: enum :: (TokenParsing p, MonadPlus p) => ThriftParser p n (Type n)
- Language.Thrift.Parser: enumDef :: (TokenParsing p, MonadPlus p) => ThriftParser p n (EnumDef n)
- Language.Thrift.Parser: exception :: (TokenParsing p, MonadPlus p) => ThriftParser p n (Type n)
- Language.Thrift.Parser: field :: (TokenParsing p, MonadPlus p) => ThriftParser p n (Field n)
- Language.Thrift.Parser: fieldRequiredness :: (TokenParsing p, MonadPlus p) => ThriftParser p n FieldRequiredness
- Language.Thrift.Parser: instance (GHC.Base.MonadPlus p, Text.Parser.Char.CharParsing p) => Text.Parser.Char.CharParsing (Language.Thrift.Parser.ThriftParser p n)
- Language.Thrift.Parser: instance (GHC.Base.MonadPlus p, Text.Parser.Combinators.Parsing p) => Text.Parser.Combinators.Parsing (Language.Thrift.Parser.ThriftParser p n)
- Language.Thrift.Parser: instance (Text.Parser.Token.TokenParsing p, GHC.Base.MonadPlus p) => Text.Parser.Token.TokenParsing (Language.Thrift.Parser.ThriftParser p n)
- Language.Thrift.Parser: instance GHC.Base.Functor p => GHC.Base.Functor (Language.Thrift.Parser.ThriftParser p n)
- Language.Thrift.Parser: instance GHC.Base.Monad p => GHC.Base.Applicative (Language.Thrift.Parser.ThriftParser p n)
- Language.Thrift.Parser: instance GHC.Base.Monad p => GHC.Base.Monad (Language.Thrift.Parser.ThriftParser p n)
- Language.Thrift.Parser: instance GHC.Base.MonadPlus p => GHC.Base.Alternative (Language.Thrift.Parser.ThriftParser p n)
- Language.Thrift.Parser: instance GHC.Base.MonadPlus p => GHC.Base.MonadPlus (Language.Thrift.Parser.ThriftParser p n)
- Language.Thrift.Parser: instance GHC.Classes.Eq Language.Thrift.Parser.ParserState
- Language.Thrift.Parser: instance GHC.Classes.Ord Language.Thrift.Parser.ParserState
- Language.Thrift.Parser: instance GHC.Show.Show Language.Thrift.Parser.ParserState
- Language.Thrift.Parser: senum :: (TokenParsing p, MonadPlus p) => ThriftParser p n (Type n)
- Language.Thrift.Parser: service :: (TokenParsing p, MonadPlus p) => ThriftParser p n (Definition n)
- Language.Thrift.Parser: struct :: (TokenParsing p, MonadPlus p) => ThriftParser p n (Type n)
- Language.Thrift.Parser: typeAnnotations :: (TokenParsing p, MonadPlus p) => ThriftParser p n [TypeAnnotation]
- Language.Thrift.Parser: typeDefinition :: (TokenParsing p, MonadPlus p) => ThriftParser p n (Definition n)
- Language.Thrift.Parser: typedef :: (TokenParsing p, MonadPlus p) => ThriftParser p n (Type n)
- Language.Thrift.Parser: union :: (TokenParsing p, MonadPlus p) => ThriftParser p n (Type n)
- Language.Thrift.Types: [constDocstring] :: Definition srcAnnot -> Docstring
- Language.Thrift.Types: [constName] :: Definition srcAnnot -> Text
- Language.Thrift.Types: [constSrcAnnot] :: Definition srcAnnot -> srcAnnot
- Language.Thrift.Types: [constType] :: Definition srcAnnot -> FieldType
- Language.Thrift.Types: [constValue] :: Definition srcAnnot -> ConstValue
- Language.Thrift.Types: [enumDefAnnotations] :: EnumDef srcAnnot -> [TypeAnnotation]
- Language.Thrift.Types: [enumDefDocstring] :: EnumDef srcAnnot -> Docstring
- Language.Thrift.Types: [enumDefName] :: EnumDef srcAnnot -> Text
- Language.Thrift.Types: [enumDefSrcAnnot] :: EnumDef srcAnnot -> srcAnnot
- Language.Thrift.Types: [enumDefValue] :: EnumDef srcAnnot -> Maybe Integer
- Language.Thrift.Types: [enumDocstring] :: Type srcAnnot -> Docstring
- Language.Thrift.Types: [enumName] :: Type srcAnnot -> Text
- Language.Thrift.Types: [enumSrcAnnot] :: Type srcAnnot -> srcAnnot
- Language.Thrift.Types: [enumValues] :: Type srcAnnot -> [EnumDef srcAnnot]
- Language.Thrift.Types: [exceptionDocstring] :: Type srcAnnot -> Docstring
- Language.Thrift.Types: [exceptionFields] :: Type srcAnnot -> [Field srcAnnot]
- Language.Thrift.Types: [exceptionName] :: Type srcAnnot -> Text
- Language.Thrift.Types: [exceptionSrcAnnot] :: Type srcAnnot -> srcAnnot
- Language.Thrift.Types: [fieldAnnotations] :: Field srcAnnot -> [TypeAnnotation]
- Language.Thrift.Types: [fieldDefault] :: Field srcAnnot -> Maybe ConstValue
- Language.Thrift.Types: [fieldDocstring] :: Field srcAnnot -> Docstring
- Language.Thrift.Types: [fieldIdentifier] :: Field srcAnnot -> Maybe Integer
- Language.Thrift.Types: [fieldName] :: Field srcAnnot -> Text
- Language.Thrift.Types: [fieldRequiredNess] :: Field srcAnnot -> Maybe FieldRequiredness
- Language.Thrift.Types: [fieldSrcAnnot] :: Field srcAnnot -> srcAnnot
- Language.Thrift.Types: [fieldType] :: Field srcAnnot -> FieldType
- Language.Thrift.Types: [functionAnnotations] :: Function srcAnnot -> [TypeAnnotation]
- Language.Thrift.Types: [functionDocstring] :: Function srcAnnot -> Docstring
- Language.Thrift.Types: [functionExceptions] :: Function srcAnnot -> Maybe [Field srcAnnot]
- Language.Thrift.Types: [functionName] :: Function srcAnnot -> Text
- Language.Thrift.Types: [functionOneWay] :: Function srcAnnot -> Bool
- Language.Thrift.Types: [functionParameters] :: Function srcAnnot -> [Field srcAnnot]
- Language.Thrift.Types: [functionReturnType] :: Function srcAnnot -> Maybe FieldType
- Language.Thrift.Types: [functionSrcAnnot] :: Function srcAnnot -> srcAnnot
- Language.Thrift.Types: [includePath] :: Header -> Text
- Language.Thrift.Types: [namespaceLanguage] :: Header -> Text
- Language.Thrift.Types: [namespaceName] :: Header -> Text
- Language.Thrift.Types: [programDefinitions] :: Program srcAnnot -> [Definition srcAnnot]
- Language.Thrift.Types: [programHeaders] :: Program srcAnnot -> [Header]
- Language.Thrift.Types: [senumDocstring] :: Type srcAnnot -> Docstring
- Language.Thrift.Types: [senumName] :: Type srcAnnot -> Text
- Language.Thrift.Types: [senumSrcAnnot] :: Type srcAnnot -> srcAnnot
- Language.Thrift.Types: [senumValues] :: Type srcAnnot -> [Text]
- Language.Thrift.Types: [serviceAnnotations] :: Definition srcAnnot -> [TypeAnnotation]
- Language.Thrift.Types: [serviceDocstring] :: Definition srcAnnot -> Docstring
- Language.Thrift.Types: [serviceExtends] :: Definition srcAnnot -> Maybe Text
- Language.Thrift.Types: [serviceFunctions] :: Definition srcAnnot -> [Function srcAnnot]
- Language.Thrift.Types: [serviceName] :: Definition srcAnnot -> Text
- Language.Thrift.Types: [serviceSrcAnnot] :: Definition srcAnnot -> srcAnnot
- Language.Thrift.Types: [structDocstring] :: Type srcAnnot -> Docstring
- Language.Thrift.Types: [structFields] :: Type srcAnnot -> [Field srcAnnot]
- Language.Thrift.Types: [structName] :: Type srcAnnot -> Text
- Language.Thrift.Types: [structSrcAnnot] :: Type srcAnnot -> srcAnnot
- Language.Thrift.Types: [typeAnnotationName] :: TypeAnnotation -> Text
- Language.Thrift.Types: [typeAnnotationValue] :: TypeAnnotation -> Text
- Language.Thrift.Types: [typeAnnotations] :: Definition srcAnnot -> [TypeAnnotation]
- Language.Thrift.Types: [typeDefinition] :: Definition srcAnnot -> Type srcAnnot
- Language.Thrift.Types: [typedefDocstring] :: Type srcAnnot -> Docstring
- Language.Thrift.Types: [typedefName] :: Type srcAnnot -> Text
- Language.Thrift.Types: [typedefSrcAnnot] :: Type srcAnnot -> srcAnnot
- Language.Thrift.Types: [typedefType] :: Type srcAnnot -> FieldType
- Language.Thrift.Types: [unionDocstring] :: Type srcAnnot -> Docstring
- Language.Thrift.Types: [unionFields] :: Type srcAnnot -> [Field srcAnnot]
- Language.Thrift.Types: [unionName] :: Type srcAnnot -> Text
- Language.Thrift.Types: [unionSrcAnnot] :: Type srcAnnot -> srcAnnot
- Language.Thrift.Types: instance Data.Data.Data Language.Thrift.Types.ConstValue
- Language.Thrift.Types: instance Data.Data.Data Language.Thrift.Types.FieldRequiredness
- Language.Thrift.Types: instance Data.Data.Data Language.Thrift.Types.FieldType
- Language.Thrift.Types: instance Data.Data.Data Language.Thrift.Types.Header
- Language.Thrift.Types: instance Data.Data.Data Language.Thrift.Types.TypeAnnotation
- Language.Thrift.Types: instance Data.Data.Data srcAnnot => Data.Data.Data (Language.Thrift.Types.Definition srcAnnot)
- Language.Thrift.Types: instance Data.Data.Data srcAnnot => Data.Data.Data (Language.Thrift.Types.EnumDef srcAnnot)
- Language.Thrift.Types: instance Data.Data.Data srcAnnot => Data.Data.Data (Language.Thrift.Types.Field srcAnnot)
- Language.Thrift.Types: instance Data.Data.Data srcAnnot => Data.Data.Data (Language.Thrift.Types.Function srcAnnot)
- Language.Thrift.Types: instance Data.Data.Data srcAnnot => Data.Data.Data (Language.Thrift.Types.Program srcAnnot)
- Language.Thrift.Types: instance Data.Data.Data srcAnnot => Data.Data.Data (Language.Thrift.Types.Type srcAnnot)
- Language.Thrift.Types: instance GHC.Classes.Eq Language.Thrift.Types.ConstValue
- Language.Thrift.Types: instance GHC.Classes.Eq Language.Thrift.Types.FieldRequiredness
- Language.Thrift.Types: instance GHC.Classes.Eq Language.Thrift.Types.FieldType
- Language.Thrift.Types: instance GHC.Classes.Eq Language.Thrift.Types.Header
- Language.Thrift.Types: instance GHC.Classes.Eq Language.Thrift.Types.TypeAnnotation
- Language.Thrift.Types: instance GHC.Classes.Eq srcAnnot => GHC.Classes.Eq (Language.Thrift.Types.Definition srcAnnot)
- Language.Thrift.Types: instance GHC.Classes.Eq srcAnnot => GHC.Classes.Eq (Language.Thrift.Types.EnumDef srcAnnot)
- Language.Thrift.Types: instance GHC.Classes.Eq srcAnnot => GHC.Classes.Eq (Language.Thrift.Types.Field srcAnnot)
- Language.Thrift.Types: instance GHC.Classes.Eq srcAnnot => GHC.Classes.Eq (Language.Thrift.Types.Function srcAnnot)
- Language.Thrift.Types: instance GHC.Classes.Eq srcAnnot => GHC.Classes.Eq (Language.Thrift.Types.Program srcAnnot)
- Language.Thrift.Types: instance GHC.Classes.Eq srcAnnot => GHC.Classes.Eq (Language.Thrift.Types.Type srcAnnot)
- Language.Thrift.Types: instance GHC.Classes.Ord Language.Thrift.Types.ConstValue
- Language.Thrift.Types: instance GHC.Classes.Ord Language.Thrift.Types.FieldRequiredness
- Language.Thrift.Types: instance GHC.Classes.Ord Language.Thrift.Types.FieldType
- Language.Thrift.Types: instance GHC.Classes.Ord Language.Thrift.Types.Header
- Language.Thrift.Types: instance GHC.Classes.Ord Language.Thrift.Types.TypeAnnotation
- Language.Thrift.Types: instance GHC.Classes.Ord srcAnnot => GHC.Classes.Ord (Language.Thrift.Types.Definition srcAnnot)
- Language.Thrift.Types: instance GHC.Classes.Ord srcAnnot => GHC.Classes.Ord (Language.Thrift.Types.EnumDef srcAnnot)
- Language.Thrift.Types: instance GHC.Classes.Ord srcAnnot => GHC.Classes.Ord (Language.Thrift.Types.Field srcAnnot)
- Language.Thrift.Types: instance GHC.Classes.Ord srcAnnot => GHC.Classes.Ord (Language.Thrift.Types.Function srcAnnot)
- Language.Thrift.Types: instance GHC.Classes.Ord srcAnnot => GHC.Classes.Ord (Language.Thrift.Types.Program srcAnnot)
- Language.Thrift.Types: instance GHC.Classes.Ord srcAnnot => GHC.Classes.Ord (Language.Thrift.Types.Type srcAnnot)
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_0ConstValue
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_0Definition
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_0EnumDef
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_0Field
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_0FieldRequiredness
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_0FieldType
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_0Function
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_0Header
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_0Program
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_0Type
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_0TypeAnnotation
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_10FieldType
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_11FieldType
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_12FieldType
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_1ConstValue
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_1Definition
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_1FieldRequiredness
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_1FieldType
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_1Header
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_1Type
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_2ConstValue
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_2Definition
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_2FieldType
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_2Type
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_3ConstValue
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_3FieldType
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_3Type
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_4ConstValue
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_4FieldType
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_4Type
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_5ConstValue
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_5FieldType
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_5Type
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_6FieldType
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_7FieldType
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_8FieldType
- Language.Thrift.Types: instance GHC.Generics.Constructor Language.Thrift.Types.C1_9FieldType
- Language.Thrift.Types: instance GHC.Generics.Datatype Language.Thrift.Types.D1ConstValue
- Language.Thrift.Types: instance GHC.Generics.Datatype Language.Thrift.Types.D1Definition
- Language.Thrift.Types: instance GHC.Generics.Datatype Language.Thrift.Types.D1EnumDef
- Language.Thrift.Types: instance GHC.Generics.Datatype Language.Thrift.Types.D1Field
- Language.Thrift.Types: instance GHC.Generics.Datatype Language.Thrift.Types.D1FieldRequiredness
- Language.Thrift.Types: instance GHC.Generics.Datatype Language.Thrift.Types.D1FieldType
- Language.Thrift.Types: instance GHC.Generics.Datatype Language.Thrift.Types.D1Function
- Language.Thrift.Types: instance GHC.Generics.Datatype Language.Thrift.Types.D1Header
- Language.Thrift.Types: instance GHC.Generics.Datatype Language.Thrift.Types.D1Program
- Language.Thrift.Types: instance GHC.Generics.Datatype Language.Thrift.Types.D1Type
- Language.Thrift.Types: instance GHC.Generics.Datatype Language.Thrift.Types.D1TypeAnnotation
- Language.Thrift.Types: instance GHC.Generics.Generic (Language.Thrift.Types.Definition srcAnnot)
- Language.Thrift.Types: instance GHC.Generics.Generic (Language.Thrift.Types.EnumDef srcAnnot)
- Language.Thrift.Types: instance GHC.Generics.Generic (Language.Thrift.Types.Field srcAnnot)
- Language.Thrift.Types: instance GHC.Generics.Generic (Language.Thrift.Types.Function srcAnnot)
- Language.Thrift.Types: instance GHC.Generics.Generic (Language.Thrift.Types.Program srcAnnot)
- Language.Thrift.Types: instance GHC.Generics.Generic (Language.Thrift.Types.Type srcAnnot)
- Language.Thrift.Types: instance GHC.Generics.Generic Language.Thrift.Types.ConstValue
- Language.Thrift.Types: instance GHC.Generics.Generic Language.Thrift.Types.FieldRequiredness
- Language.Thrift.Types: instance GHC.Generics.Generic Language.Thrift.Types.FieldType
- Language.Thrift.Types: instance GHC.Generics.Generic Language.Thrift.Types.Header
- Language.Thrift.Types: instance GHC.Generics.Generic Language.Thrift.Types.TypeAnnotation
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_0Definition
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_0EnumDef
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_0Field
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_0Function
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_0Header
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_0Program
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_0Type
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_0TypeAnnotation
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_1Definition
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_1EnumDef
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_1Field
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_1Function
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_1Program
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_1Type
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_1TypeAnnotation
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_2Definition
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_2EnumDef
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_2Field
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_2Function
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_2Type
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_3Definition
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_3EnumDef
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_3Field
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_3Function
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_3Type
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_4Definition
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_4EnumDef
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_4Field
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_4Function
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_5Field
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_5Function
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_6Field
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_6Function
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_7Field
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_0_7Function
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_1_0Definition
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_1_0Header
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_1_0Type
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_1_1Definition
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_1_1Header
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_1_1Type
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_1_2Type
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_1_3Type
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_2_0Definition
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_2_0Type
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_2_1Definition
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_2_1Type
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_2_2Definition
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_2_2Type
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_2_3Definition
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_2_3Type
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_2_4Definition
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_2_5Definition
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_3_0Type
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_3_1Type
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_3_2Type
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_3_3Type
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_4_0Type
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_4_1Type
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_4_2Type
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_4_3Type
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_5_0Type
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_5_1Type
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_5_2Type
- Language.Thrift.Types: instance GHC.Generics.Selector Language.Thrift.Types.S1_5_3Type
- Language.Thrift.Types: instance GHC.Show.Show Language.Thrift.Types.ConstValue
- Language.Thrift.Types: instance GHC.Show.Show Language.Thrift.Types.FieldRequiredness
- Language.Thrift.Types: instance GHC.Show.Show Language.Thrift.Types.FieldType
- Language.Thrift.Types: instance GHC.Show.Show Language.Thrift.Types.Header
- Language.Thrift.Types: instance GHC.Show.Show Language.Thrift.Types.TypeAnnotation
- Language.Thrift.Types: instance GHC.Show.Show srcAnnot => GHC.Show.Show (Language.Thrift.Types.Definition srcAnnot)
- Language.Thrift.Types: instance GHC.Show.Show srcAnnot => GHC.Show.Show (Language.Thrift.Types.EnumDef srcAnnot)
- Language.Thrift.Types: instance GHC.Show.Show srcAnnot => GHC.Show.Show (Language.Thrift.Types.Field srcAnnot)
- Language.Thrift.Types: instance GHC.Show.Show srcAnnot => GHC.Show.Show (Language.Thrift.Types.Function srcAnnot)
- Language.Thrift.Types: instance GHC.Show.Show srcAnnot => GHC.Show.Show (Language.Thrift.Types.Program srcAnnot)
- Language.Thrift.Types: instance GHC.Show.Show srcAnnot => GHC.Show.Show (Language.Thrift.Types.Type srcAnnot)
+ Language.Thrift.Parser: instance (Functor p, MonadPlus p) => Alternative (ThriftParser p n)
+ Language.Thrift.Parser: instance (Monad p, Functor p) => Applicative (ThriftParser p n)
+ Language.Thrift.Parser: instance (MonadPlus p, CharParsing p) => CharParsing (ThriftParser p n)
+ Language.Thrift.Parser: instance (MonadPlus p, Parsing p) => Parsing (ThriftParser p n)
+ Language.Thrift.Parser: instance (TokenParsing p, MonadPlus p) => TokenParsing (ThriftParser p n)
+ Language.Thrift.Parser: instance Eq ParserState
+ Language.Thrift.Parser: instance Functor p => Functor (ThriftParser p n)
+ Language.Thrift.Parser: instance Monad p => Monad (ThriftParser p n)
+ Language.Thrift.Parser: instance MonadPlus p => MonadPlus (ThriftParser p n)
+ Language.Thrift.Parser: instance Ord ParserState
+ Language.Thrift.Parser: instance Show ParserState
+ Language.Thrift.Pretty: Config :: Int -> Config
+ Language.Thrift.Pretty: constantValue :: Config -> ConstValue -> Doc
+ Language.Thrift.Pretty: data Config
+ Language.Thrift.Pretty: defaultConfig :: Config
+ Language.Thrift.Pretty: definition :: Config -> Definition ann -> Doc
+ Language.Thrift.Pretty: fieldType :: Config -> FieldType -> Doc
+ Language.Thrift.Pretty: function :: Config -> Function ann -> Doc
+ Language.Thrift.Pretty: header :: Header -> Doc
+ Language.Thrift.Pretty: indentWidth :: Config -> Int
+ Language.Thrift.Pretty: instance Eq Config
+ Language.Thrift.Pretty: instance Ord Config
+ Language.Thrift.Pretty: instance Show Config
+ Language.Thrift.Pretty: prettyPrint :: Program ann -> Doc
+ Language.Thrift.Pretty: program :: Config -> Program ann -> Doc
+ Language.Thrift.Types: constDocstring :: Definition srcAnnot -> Docstring
+ Language.Thrift.Types: constName :: Definition srcAnnot -> Text
+ Language.Thrift.Types: constSrcAnnot :: Definition srcAnnot -> srcAnnot
+ Language.Thrift.Types: constType :: Definition srcAnnot -> FieldType
+ Language.Thrift.Types: constValue :: Definition srcAnnot -> ConstValue
+ Language.Thrift.Types: enumDefAnnotations :: EnumDef srcAnnot -> [TypeAnnotation]
+ Language.Thrift.Types: enumDefDocstring :: EnumDef srcAnnot -> Docstring
+ Language.Thrift.Types: enumDefName :: EnumDef srcAnnot -> Text
+ Language.Thrift.Types: enumDefSrcAnnot :: EnumDef srcAnnot -> srcAnnot
+ Language.Thrift.Types: enumDefValue :: EnumDef srcAnnot -> Maybe Integer
+ Language.Thrift.Types: enumDocstring :: Type srcAnnot -> Docstring
+ Language.Thrift.Types: enumName :: Type srcAnnot -> Text
+ Language.Thrift.Types: enumSrcAnnot :: Type srcAnnot -> srcAnnot
+ Language.Thrift.Types: enumValues :: Type srcAnnot -> [EnumDef srcAnnot]
+ Language.Thrift.Types: exceptionDocstring :: Type srcAnnot -> Docstring
+ Language.Thrift.Types: exceptionFields :: Type srcAnnot -> [Field srcAnnot]
+ Language.Thrift.Types: exceptionName :: Type srcAnnot -> Text
+ Language.Thrift.Types: exceptionSrcAnnot :: Type srcAnnot -> srcAnnot
+ Language.Thrift.Types: fieldAnnotations :: Field srcAnnot -> [TypeAnnotation]
+ Language.Thrift.Types: fieldDefault :: Field srcAnnot -> Maybe ConstValue
+ Language.Thrift.Types: fieldDocstring :: Field srcAnnot -> Docstring
+ Language.Thrift.Types: fieldIdentifier :: Field srcAnnot -> Maybe Integer
+ Language.Thrift.Types: fieldName :: Field srcAnnot -> Text
+ Language.Thrift.Types: fieldRequiredness :: Field srcAnnot -> Maybe FieldRequiredness
+ Language.Thrift.Types: fieldSrcAnnot :: Field srcAnnot -> srcAnnot
+ Language.Thrift.Types: fieldType :: Field srcAnnot -> FieldType
+ Language.Thrift.Types: functionAnnotations :: Function srcAnnot -> [TypeAnnotation]
+ Language.Thrift.Types: functionDocstring :: Function srcAnnot -> Docstring
+ Language.Thrift.Types: functionExceptions :: Function srcAnnot -> Maybe [Field srcAnnot]
+ Language.Thrift.Types: functionName :: Function srcAnnot -> Text
+ Language.Thrift.Types: functionOneWay :: Function srcAnnot -> Bool
+ Language.Thrift.Types: functionParameters :: Function srcAnnot -> [Field srcAnnot]
+ Language.Thrift.Types: functionReturnType :: Function srcAnnot -> Maybe FieldType
+ Language.Thrift.Types: functionSrcAnnot :: Function srcAnnot -> srcAnnot
+ Language.Thrift.Types: includePath :: Header -> Text
+ Language.Thrift.Types: instance Constructor C1_0ConstValue
+ Language.Thrift.Types: instance Constructor C1_0Definition
+ Language.Thrift.Types: instance Constructor C1_0EnumDef
+ Language.Thrift.Types: instance Constructor C1_0Field
+ Language.Thrift.Types: instance Constructor C1_0FieldRequiredness
+ Language.Thrift.Types: instance Constructor C1_0FieldType
+ Language.Thrift.Types: instance Constructor C1_0Function
+ Language.Thrift.Types: instance Constructor C1_0Header
+ Language.Thrift.Types: instance Constructor C1_0Program
+ Language.Thrift.Types: instance Constructor C1_0Type
+ Language.Thrift.Types: instance Constructor C1_0TypeAnnotation
+ Language.Thrift.Types: instance Constructor C1_10FieldType
+ Language.Thrift.Types: instance Constructor C1_11FieldType
+ Language.Thrift.Types: instance Constructor C1_12FieldType
+ Language.Thrift.Types: instance Constructor C1_1ConstValue
+ Language.Thrift.Types: instance Constructor C1_1Definition
+ Language.Thrift.Types: instance Constructor C1_1FieldRequiredness
+ Language.Thrift.Types: instance Constructor C1_1FieldType
+ Language.Thrift.Types: instance Constructor C1_1Header
+ Language.Thrift.Types: instance Constructor C1_1Type
+ Language.Thrift.Types: instance Constructor C1_2ConstValue
+ Language.Thrift.Types: instance Constructor C1_2Definition
+ Language.Thrift.Types: instance Constructor C1_2FieldType
+ Language.Thrift.Types: instance Constructor C1_2Type
+ Language.Thrift.Types: instance Constructor C1_3ConstValue
+ Language.Thrift.Types: instance Constructor C1_3FieldType
+ Language.Thrift.Types: instance Constructor C1_3Type
+ Language.Thrift.Types: instance Constructor C1_4ConstValue
+ Language.Thrift.Types: instance Constructor C1_4FieldType
+ Language.Thrift.Types: instance Constructor C1_4Type
+ Language.Thrift.Types: instance Constructor C1_5ConstValue
+ Language.Thrift.Types: instance Constructor C1_5FieldType
+ Language.Thrift.Types: instance Constructor C1_5Type
+ Language.Thrift.Types: instance Constructor C1_6FieldType
+ Language.Thrift.Types: instance Constructor C1_7FieldType
+ Language.Thrift.Types: instance Constructor C1_8FieldType
+ Language.Thrift.Types: instance Constructor C1_9FieldType
+ Language.Thrift.Types: instance Data ConstValue
+ Language.Thrift.Types: instance Data FieldRequiredness
+ Language.Thrift.Types: instance Data FieldType
+ Language.Thrift.Types: instance Data Header
+ Language.Thrift.Types: instance Data TypeAnnotation
+ Language.Thrift.Types: instance Data srcAnnot => Data (Definition srcAnnot)
+ Language.Thrift.Types: instance Data srcAnnot => Data (EnumDef srcAnnot)
+ Language.Thrift.Types: instance Data srcAnnot => Data (Field srcAnnot)
+ Language.Thrift.Types: instance Data srcAnnot => Data (Function srcAnnot)
+ Language.Thrift.Types: instance Data srcAnnot => Data (Program srcAnnot)
+ Language.Thrift.Types: instance Data srcAnnot => Data (Type srcAnnot)
+ Language.Thrift.Types: instance Datatype D1ConstValue
+ Language.Thrift.Types: instance Datatype D1Definition
+ Language.Thrift.Types: instance Datatype D1EnumDef
+ Language.Thrift.Types: instance Datatype D1Field
+ Language.Thrift.Types: instance Datatype D1FieldRequiredness
+ Language.Thrift.Types: instance Datatype D1FieldType
+ Language.Thrift.Types: instance Datatype D1Function
+ Language.Thrift.Types: instance Datatype D1Header
+ Language.Thrift.Types: instance Datatype D1Program
+ Language.Thrift.Types: instance Datatype D1Type
+ Language.Thrift.Types: instance Datatype D1TypeAnnotation
+ Language.Thrift.Types: instance Eq ConstValue
+ Language.Thrift.Types: instance Eq FieldRequiredness
+ Language.Thrift.Types: instance Eq FieldType
+ Language.Thrift.Types: instance Eq Header
+ Language.Thrift.Types: instance Eq TypeAnnotation
+ Language.Thrift.Types: instance Eq srcAnnot => Eq (Definition srcAnnot)
+ Language.Thrift.Types: instance Eq srcAnnot => Eq (EnumDef srcAnnot)
+ Language.Thrift.Types: instance Eq srcAnnot => Eq (Field srcAnnot)
+ Language.Thrift.Types: instance Eq srcAnnot => Eq (Function srcAnnot)
+ Language.Thrift.Types: instance Eq srcAnnot => Eq (Program srcAnnot)
+ Language.Thrift.Types: instance Eq srcAnnot => Eq (Type srcAnnot)
+ Language.Thrift.Types: instance Generic (Definition srcAnnot)
+ Language.Thrift.Types: instance Generic (EnumDef srcAnnot)
+ Language.Thrift.Types: instance Generic (Field srcAnnot)
+ Language.Thrift.Types: instance Generic (Function srcAnnot)
+ Language.Thrift.Types: instance Generic (Program srcAnnot)
+ Language.Thrift.Types: instance Generic (Type srcAnnot)
+ Language.Thrift.Types: instance Generic ConstValue
+ Language.Thrift.Types: instance Generic FieldRequiredness
+ Language.Thrift.Types: instance Generic FieldType
+ Language.Thrift.Types: instance Generic Header
+ Language.Thrift.Types: instance Generic TypeAnnotation
+ Language.Thrift.Types: instance Ord ConstValue
+ Language.Thrift.Types: instance Ord FieldRequiredness
+ Language.Thrift.Types: instance Ord FieldType
+ Language.Thrift.Types: instance Ord Header
+ Language.Thrift.Types: instance Ord TypeAnnotation
+ Language.Thrift.Types: instance Ord srcAnnot => Ord (Definition srcAnnot)
+ Language.Thrift.Types: instance Ord srcAnnot => Ord (EnumDef srcAnnot)
+ Language.Thrift.Types: instance Ord srcAnnot => Ord (Field srcAnnot)
+ Language.Thrift.Types: instance Ord srcAnnot => Ord (Function srcAnnot)
+ Language.Thrift.Types: instance Ord srcAnnot => Ord (Program srcAnnot)
+ Language.Thrift.Types: instance Ord srcAnnot => Ord (Type srcAnnot)
+ Language.Thrift.Types: instance Selector S1_0_0Definition
+ Language.Thrift.Types: instance Selector S1_0_0EnumDef
+ Language.Thrift.Types: instance Selector S1_0_0Field
+ Language.Thrift.Types: instance Selector S1_0_0Function
+ Language.Thrift.Types: instance Selector S1_0_0Header
+ Language.Thrift.Types: instance Selector S1_0_0Program
+ Language.Thrift.Types: instance Selector S1_0_0Type
+ Language.Thrift.Types: instance Selector S1_0_0TypeAnnotation
+ Language.Thrift.Types: instance Selector S1_0_1Definition
+ Language.Thrift.Types: instance Selector S1_0_1EnumDef
+ Language.Thrift.Types: instance Selector S1_0_1Field
+ Language.Thrift.Types: instance Selector S1_0_1Function
+ Language.Thrift.Types: instance Selector S1_0_1Program
+ Language.Thrift.Types: instance Selector S1_0_1Type
+ Language.Thrift.Types: instance Selector S1_0_1TypeAnnotation
+ Language.Thrift.Types: instance Selector S1_0_2Definition
+ Language.Thrift.Types: instance Selector S1_0_2EnumDef
+ Language.Thrift.Types: instance Selector S1_0_2Field
+ Language.Thrift.Types: instance Selector S1_0_2Function
+ Language.Thrift.Types: instance Selector S1_0_2Type
+ Language.Thrift.Types: instance Selector S1_0_3Definition
+ Language.Thrift.Types: instance Selector S1_0_3EnumDef
+ Language.Thrift.Types: instance Selector S1_0_3Field
+ Language.Thrift.Types: instance Selector S1_0_3Function
+ Language.Thrift.Types: instance Selector S1_0_3Type
+ Language.Thrift.Types: instance Selector S1_0_4Definition
+ Language.Thrift.Types: instance Selector S1_0_4EnumDef
+ Language.Thrift.Types: instance Selector S1_0_4Field
+ Language.Thrift.Types: instance Selector S1_0_4Function
+ Language.Thrift.Types: instance Selector S1_0_5Field
+ Language.Thrift.Types: instance Selector S1_0_5Function
+ Language.Thrift.Types: instance Selector S1_0_6Field
+ Language.Thrift.Types: instance Selector S1_0_6Function
+ Language.Thrift.Types: instance Selector S1_0_7Field
+ Language.Thrift.Types: instance Selector S1_0_7Function
+ Language.Thrift.Types: instance Selector S1_1_0Definition
+ Language.Thrift.Types: instance Selector S1_1_0Header
+ Language.Thrift.Types: instance Selector S1_1_0Type
+ Language.Thrift.Types: instance Selector S1_1_1Definition
+ Language.Thrift.Types: instance Selector S1_1_1Header
+ Language.Thrift.Types: instance Selector S1_1_1Type
+ Language.Thrift.Types: instance Selector S1_1_2Type
+ Language.Thrift.Types: instance Selector S1_1_3Type
+ Language.Thrift.Types: instance Selector S1_2_0Definition
+ Language.Thrift.Types: instance Selector S1_2_0Type
+ Language.Thrift.Types: instance Selector S1_2_1Definition
+ Language.Thrift.Types: instance Selector S1_2_1Type
+ Language.Thrift.Types: instance Selector S1_2_2Definition
+ Language.Thrift.Types: instance Selector S1_2_2Type
+ Language.Thrift.Types: instance Selector S1_2_3Definition
+ Language.Thrift.Types: instance Selector S1_2_3Type
+ Language.Thrift.Types: instance Selector S1_2_4Definition
+ Language.Thrift.Types: instance Selector S1_2_5Definition
+ Language.Thrift.Types: instance Selector S1_3_0Type
+ Language.Thrift.Types: instance Selector S1_3_1Type
+ Language.Thrift.Types: instance Selector S1_3_2Type
+ Language.Thrift.Types: instance Selector S1_3_3Type
+ Language.Thrift.Types: instance Selector S1_4_0Type
+ Language.Thrift.Types: instance Selector S1_4_1Type
+ Language.Thrift.Types: instance Selector S1_4_2Type
+ Language.Thrift.Types: instance Selector S1_4_3Type
+ Language.Thrift.Types: instance Selector S1_5_0Type
+ Language.Thrift.Types: instance Selector S1_5_1Type
+ Language.Thrift.Types: instance Selector S1_5_2Type
+ Language.Thrift.Types: instance Selector S1_5_3Type
+ Language.Thrift.Types: instance Show ConstValue
+ Language.Thrift.Types: instance Show FieldRequiredness
+ Language.Thrift.Types: instance Show FieldType
+ Language.Thrift.Types: instance Show Header
+ Language.Thrift.Types: instance Show TypeAnnotation
+ Language.Thrift.Types: instance Show srcAnnot => Show (Definition srcAnnot)
+ Language.Thrift.Types: instance Show srcAnnot => Show (EnumDef srcAnnot)
+ Language.Thrift.Types: instance Show srcAnnot => Show (Field srcAnnot)
+ Language.Thrift.Types: instance Show srcAnnot => Show (Function srcAnnot)
+ Language.Thrift.Types: instance Show srcAnnot => Show (Program srcAnnot)
+ Language.Thrift.Types: instance Show srcAnnot => Show (Type srcAnnot)
+ Language.Thrift.Types: instance Typeable ConstValue
+ Language.Thrift.Types: instance Typeable Definition
+ Language.Thrift.Types: instance Typeable EnumDef
+ Language.Thrift.Types: instance Typeable Field
+ Language.Thrift.Types: instance Typeable FieldRequiredness
+ Language.Thrift.Types: instance Typeable FieldType
+ Language.Thrift.Types: instance Typeable Function
+ Language.Thrift.Types: instance Typeable Header
+ Language.Thrift.Types: instance Typeable Program
+ Language.Thrift.Types: instance Typeable Type
+ Language.Thrift.Types: instance Typeable TypeAnnotation
+ Language.Thrift.Types: namespaceLanguage :: Header -> Text
+ Language.Thrift.Types: namespaceName :: Header -> Text
+ Language.Thrift.Types: programDefinitions :: Program srcAnnot -> [Definition srcAnnot]
+ Language.Thrift.Types: programHeaders :: Program srcAnnot -> [Header]
+ Language.Thrift.Types: senumDocstring :: Type srcAnnot -> Docstring
+ Language.Thrift.Types: senumName :: Type srcAnnot -> Text
+ Language.Thrift.Types: senumSrcAnnot :: Type srcAnnot -> srcAnnot
+ Language.Thrift.Types: senumValues :: Type srcAnnot -> [Text]
+ Language.Thrift.Types: serviceAnnotations :: Definition srcAnnot -> [TypeAnnotation]
+ Language.Thrift.Types: serviceDocstring :: Definition srcAnnot -> Docstring
+ Language.Thrift.Types: serviceExtends :: Definition srcAnnot -> Maybe Text
+ Language.Thrift.Types: serviceFunctions :: Definition srcAnnot -> [Function srcAnnot]
+ Language.Thrift.Types: serviceName :: Definition srcAnnot -> Text
+ Language.Thrift.Types: serviceSrcAnnot :: Definition srcAnnot -> srcAnnot
+ Language.Thrift.Types: structDocstring :: Type srcAnnot -> Docstring
+ Language.Thrift.Types: structFields :: Type srcAnnot -> [Field srcAnnot]
+ Language.Thrift.Types: structName :: Type srcAnnot -> Text
+ Language.Thrift.Types: structSrcAnnot :: Type srcAnnot -> srcAnnot
+ Language.Thrift.Types: typeAnnotationName :: TypeAnnotation -> Text
+ Language.Thrift.Types: typeAnnotationValue :: TypeAnnotation -> Text
+ Language.Thrift.Types: typeAnnotations :: Definition srcAnnot -> [TypeAnnotation]
+ Language.Thrift.Types: typeDefinition :: Definition srcAnnot -> Type srcAnnot
+ Language.Thrift.Types: typedefDocstring :: Type srcAnnot -> Docstring
+ Language.Thrift.Types: typedefName :: Type srcAnnot -> Text
+ Language.Thrift.Types: typedefSrcAnnot :: Type srcAnnot -> srcAnnot
+ Language.Thrift.Types: typedefType :: Type srcAnnot -> FieldType
+ Language.Thrift.Types: unionDocstring :: Type srcAnnot -> Docstring
+ Language.Thrift.Types: unionFields :: Type srcAnnot -> [Field srcAnnot]
+ Language.Thrift.Types: unionName :: Type srcAnnot -> Text
+ Language.Thrift.Types: unionSrcAnnot :: Type srcAnnot -> srcAnnot
Files
- CHANGES.md +17/−7
- Language/Thrift/Parser.hs +32/−30
- Language/Thrift/Pretty.hs +265/−0
- Language/Thrift/Types.hs +2/−2
- README.md +8/−4
- examples/reformatIDL.hs +25/−0
- language-thrift.cabal +26/−7
- test/Language/Thrift/TypesSpec.hs +283/−0
- test/Spec.hs +1/−0
CHANGES.md view
@@ -1,24 +1,34 @@+0.4.0.0+=======++- Add pretty printing module.+- Parsers of different constructors are no longer exported by the parsing+ module; instead only the parsers for their corresponding types are+ exported.+- Rename record for field requiredness from `fieldRequiredNess` to+ `fieldRequiredness`.+ 0.3.0.0 ======= - Allow changing the underlying parser to any parser that implements the- `TokenParsing` class from `parsers`-- Add `thriftIDLParser` for standard use cases+ `TokenParsing` class from `parsers`.+- Add `thriftIDLParser` for standard use cases. - Add `Language.Thrift.Parser.Trifecta` with a standard Trifecta-based- parser+ parser. 0.2.0.0 ======= -- Track starting positions in source annotations-- Move docs to a separate field+- Track starting positions in source annotations.+- Move docs to a separate field. 0.1.0.1 ======= -- Allow `base` 4.9+- Allow `base` 4.9. 0.1.0.0 ======= -- Initial release+- Initial release.
Language/Thrift/Parser.hs view
@@ -24,36 +24,21 @@ -- for example, you could define a string value for an int constant. -- module Language.Thrift.Parser- (-- thriftIDL-- -- * Parser type-- , ThriftParser- , runThriftParser+ ( thriftIDL - -- * Parser components+ -- * Components , program , header , definition- , typeDefinition- , typedef- , enum- , enumDef- , senum- , struct- , union- , exception- , fieldRequiredness+ , function , fieldType- , field- , constant , constantValue- , service- , function- , typeAnnotations++ -- * Parser++ , ThriftParser+ , runThriftParser ) where import Control.Applicative@@ -176,9 +161,10 @@ ] sanitizeDocstring :: Text -> Text sanitizeDocstring =- Text.unlines . map (Text.dropWhile ignore) . Text.lines- where- ignore c = c == '*' || c == ' '+ Text.intercalate "\n"+ . map (Text.dropWhile ignore)+ . Text.lines+ where ignore c = c == '*' || c == ' ' -- | Type of identifiers allowed by Thrift.@@ -234,7 +220,9 @@ -- > data Foo = Foo { bar :: Bar, doc :: Docstring, pos :: Delta } -- > -- > parseFoo = docstring $ Foo <$> parseBar-docstring :: Monad p => ThriftParser p n (T.Docstring -> n -> a) -> ThriftParser p n a+docstring+ :: (Functor p, Monad p)+ => ThriftParser p n (T.Docstring -> n -> a) -> ThriftParser p n a docstring p = lastDocstring >>= \s -> do annot <- ThriftParser . lift $ Reader.ask >>= lift p <*> pure s <*> pure annot@@ -368,13 +356,27 @@ constList :: (TokenParsing p, MonadPlus p) => ThriftParser p n [T.ConstValue]-constList = brackets $ commaSep (constantValue <* optionalSep)+constList = symbolic '[' *> loop []+ where+ loop xs = choice [+ symbolic ']' *> return (reverse xs)+ , (:) <$> (constantValue <* optionalSep)+ <*> pure xs+ >>= loop+ ] constMap :: (TokenParsing p, MonadPlus p) => ThriftParser p n [(T.ConstValue, T.ConstValue)]-constMap = braces $ commaSep constantValuePair+constMap = symbolic '{' *> loop []+ where+ loop xs = choice [+ symbolic '}' *> return (reverse xs)+ , (:) <$> (constantValuePair <* optionalSep)+ <*> pure xs+ >>= loop+ ] constantValuePair@@ -455,7 +457,7 @@ -- | Type annotations on entitites. ----- > ("foo" = "bar", "baz" = "qux")+-- > (foo = "bar", baz = "qux") -- -- These do not usually affect code generation but allow for custom logic if -- writing your own code generator.
+ Language/Thrift/Pretty.hs view
@@ -0,0 +1,265 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE NamedFieldPuns #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE RecordWildCards #-}+-- |+-- Module : Language.Thrift.Pretty+-- Copyright : (c) Abhinav Gupta 2015+-- License : BSD3+--+-- Maintainer : Abhinav Gupta <mail@abhinavg.net>+-- Stability : experimental+--+-- This module provides a pretty printer for Thrift IDLs. The pretty printer+-- prserves docstrings specified for types.+--+-- The specifics of the printer can be configured using 'Config' objects.+--+module Language.Thrift.Pretty+ (+ prettyPrint++ -- * Components++ , program+ , header+ , definition+ , function+ , fieldType+ , constantValue++ -- * Configuration++ , Config(..)+ , defaultConfig+ ) where++#if __GLASGOW_HASKELL__ >= 709+import Prelude hiding ((<$>))+#endif++import Data.Text (Text, unpack)+import Text.PrettyPrint.Leijen hiding (encloseSep, indent, text)++import qualified Data.Text as Text+import qualified Language.Thrift.Types as T+import qualified Text.PrettyPrint.Leijen as PP+++-- | Configuration for the pretty printer.+data Config = Config+ { indentWidth :: Int+ -- ^ Number of spaces to use for indentation.+ } deriving (Show, Ord, Eq)+++-- | Default pretty printing configuration.+defaultConfig :: Config+defaultConfig = Config 4+++-- | Top-level pretty printer for Thrift documents that uses the default+-- configuration ('defaultConfig') for pretty printing.+prettyPrint :: T.Program ann -> Doc+prettyPrint = program defaultConfig+++-- | Pretty print a Thrift IDL.+program :: Config -> T.Program ann -> Doc+program c T.Program{..} =+ vsep (map header programHeaders) <$> line <>+ map (definition c) programDefinitions `sepBy` (line <> line)+++-- | Print the headers for a program.+header :: T.Header -> Doc+header T.Include{..} =+ text "include" <+> literal includePath+header T.Namespace{..} = hsep+ [text "namespace", text namespaceLanguage, text namespaceName]+++-- | Print a constant, type, or service definition.+definition :: Config -> T.Definition ann -> Doc+definition c T.ConstDefinition{..} = constDocstring $$ hsep+ [ text "const"+ , fieldType c constType+ , text constName+ , text "="+ , constantValue c constValue+ ]++definition c T.TypeDefinition{typeDefinition = def, ..} =+ typeDefinition c def <> typeAnnots c typeAnnotations++definition c@Config{indentWidth} T.ServiceDefinition{..} =+ serviceDocstring $$+ text "service" <+> text serviceName <> extends <+>+ block indentWidth (line <> line) (map (function c) serviceFunctions) <>+ typeAnnots c serviceAnnotations+ where+ extends = case serviceExtends of+ Nothing -> empty+ Just name -> space <> text "extends" <+> text name+++-- | Pretty print a function definition.+--+function :: Config -> T.Function ann -> Doc+function c@Config{indentWidth} T.Function{..} = functionDocstring $$+ oneway <> returnType <+> text functionName <>+ encloseSep+ indentWidth lparen rparen comma+ (map (field c) functionParameters) <>+ exceptions <> typeAnnots c functionAnnotations <> semi+ where+ exceptions = case functionExceptions of+ Nothing -> empty+ Just es -> space <> text "throws" <+>+ encloseSep indentWidth lparen rparen comma (map (field c) es)+ returnType = case functionReturnType of+ Nothing -> text "void"+ Just rt -> fieldType c rt+ oneway =+ if functionOneWay+ then text "oneway" <> space+ else empty+++typeDefinition :: Config -> T.Type ann -> Doc+typeDefinition c@Config{indentWidth} t = case t of+ T.Typedef{..} -> typedefDocstring $$+ text "typedef" <+> fieldType c typedefType <+> text typedefName+ T.Enum{..} -> enumDocstring $$+ text "enum" <+> text enumName <+>+ block indentWidth (comma <> line) (map (enumValue c) enumValues)+ T.Struct{..} -> structDocstring $$+ text "struct" <+> text structName <+>+ block indentWidth line (map (\f -> field c f <> semi) structFields)+ T.Union{..} -> unionDocstring $$+ text "union" <+> text unionName <+>+ block indentWidth line (map (\f -> field c f <> semi) unionFields)+ T.Exception{..} -> exceptionDocstring $$+ text "exception" <+> text exceptionName <+>+ block indentWidth line (map (\f -> field c f <> semi) exceptionFields)+ T.Senum{..} -> senumDocstring $$+ text "senum" <+> text senumName <+>+ encloseSep indentWidth lbrace rbrace comma (map literal senumValues)+++field :: Config -> T.Field ann -> Doc+field c T.Field{fieldType = typ, ..} = fieldDocstring $$+ hcat [fid, req, fieldType c typ, space, text fieldName, def, annots]+ where+ fid = case fieldIdentifier of+ Nothing -> empty+ Just i -> integer i <> colon <> space+ req = case fieldRequiredness of+ Nothing -> empty+ Just T.Optional -> text "optional "+ Just T.Required -> text "required "+ def = case fieldDefault of+ Nothing -> empty+ Just v -> space <> equals <+> constantValue c v+ annots = typeAnnots c fieldAnnotations+++enumValue :: Config -> T.EnumDef ann -> Doc+enumValue c T.EnumDef{..} = enumDefDocstring $$+ text enumDefName <> value <> typeAnnots c enumDefAnnotations+ where+ value = case enumDefValue of+ Nothing -> empty+ Just v -> space <> text "=" <+> integer v+++-- | Pretty print a field type.+fieldType :: Config -> T.FieldType -> Doc+fieldType c ft = case ft of+ T.DefinedType t -> text t++ T.StringType anns -> text "string" <> typeAnnots c anns+ T.BinaryType anns -> text "binary" <> typeAnnots c anns+ T.SListType anns -> text "slist" <> typeAnnots c anns+ T.BoolType anns -> text "bool" <> typeAnnots c anns+ T.ByteType anns -> text "byte" <> typeAnnots c anns+ T.I16Type anns -> text "i16" <> typeAnnots c anns+ T.I32Type anns -> text "i32" <> typeAnnots c anns+ T.I64Type anns -> text "i64" <> typeAnnots c anns+ T.DoubleType anns -> text "double" <> typeAnnots c anns++ T.MapType k v anns ->+ text "map" <> angles (fieldType c k <> comma <+> fieldType c v)+ <> typeAnnots c anns+ T.SetType v anns ->+ text "set" <> angles (fieldType c v) <> typeAnnots c anns+ T.ListType v anns ->+ text "list" <> angles (fieldType c v) <> typeAnnots c anns+++-- | Pretty print a constant value.+constantValue :: Config -> T.ConstValue -> Doc+constantValue c@Config{indentWidth} value = case value of+ T.ConstInt i -> integer i+ T.ConstFloat f -> double f+ T.ConstLiteral l -> literal l+ T.ConstIdentifier i -> text i++ T.ConstList vs ->+ encloseSep indentWidth lbracket rbracket comma $+ map (constantValue c) vs+ T.ConstMap vs ->+ encloseSep indentWidth lbrace rbrace comma $+ map (\(k, v) -> constantValue c k <> colon <+> constantValue c v)+ vs+++typeAnnots :: Config -> [T.TypeAnnotation] -> Doc+typeAnnots _ [] = empty+typeAnnots Config{indentWidth} anns =+ space <> encloseSep indentWidth lparen rparen comma (map typeAnnot anns)+++typeAnnot :: T.TypeAnnotation -> Doc+typeAnnot T.TypeAnnotation{..} =+ text typeAnnotationName <+> equals <+> literal typeAnnotationValue+++literal :: Text -> Doc+literal = dquotes . text+ -- TODO: escaping?++text :: Text -> Doc+text = PP.text . unpack+++($$) :: T.Docstring -> Doc -> Doc+($$) Nothing y = y+($$) (Just t) y = case Text.lines (Text.strip t) of+ [] -> y+ ls -> wrapComments ls <$> y+ where+ wrapComments ls = align . vsep+ $ text "/**"+ : map (\l -> text " *" <+> text l) ls+ ++ [text " */"]++infixr 1 $$+++block :: Int -> Doc -> [Doc] -> Doc+block indent s items = braces $+ nest indent (linebreak <> (items `sepBy` s)) <> linebreak++sepBy :: [Doc] -> Doc -> Doc+sepBy [] _ = empty+sepBy [x] _ = x+sepBy (x:xs) s = x <> s <> sepBy xs s++encloseSep :: Int -> Doc -> Doc -> Doc -> [Doc] -> Doc+encloseSep _ left right _ [] = left <> right+encloseSep _ left right _ [v] = left <> v <> right+encloseSep indent left right s vs = group $+ nest indent (left <$$> go vs) <$$> right+ where go [x] = x+ go (x:xs) = (x <> s) <$> go xs
Language/Thrift/Types.hs view
@@ -201,7 +201,7 @@ -- -- While this is optional, it is recommended that Thrift files always -- contain specific field IDs.- , fieldRequiredNess :: Maybe FieldRequiredness+ , fieldRequiredness :: Maybe FieldRequiredness -- ^ Whether this field is required or not. -- -- Behavior may differ between languages if requiredness is not specified.@@ -311,7 +311,7 @@ -- | Type annoations may be added in various places in the form, ----- > ("foo" = "bar", "baz" = "qux")+-- > (foo = "bar", baz = "qux") -- -- These do not usually affect code generation but allow for custom logic if -- writing your own code generator.
README.md view
@@ -1,15 +1,19 @@-`language-thrift` provides a parser for the [Thrift IDL format]. In addition to-parsing the IDL, it keeps track of Javadoc-style comments (`/** ... */`) and-attaches them to the type, service, function, or field, above which they were-added.+`language-thrift` provides a parser and pretty printer for the [Thrift IDL+format]. In addition to parsing the IDL, it keeps track of Javadoc-style+comments (`/** ... */`) and attaches them to the type, service, function, or+field, above which they were added. These are retained when the document is+sent through the pretty printer. The parser uses [`parsers`] to allow plugging in the underlying parser. A default [`trifecta`] based parser is provided. +The pretty printer uses [wl-pprint].+ Haddock-generated docs are available on [Hackage] and [here]. [Thrift IDL format]: http://thrift.apache.org/docs/idl [`parsers`]: http://hackage.haskell.org/package/parsers [`trifecta`]: http://hackage.haskell.org/package/trifecta+ [wl-pprint]: http://hackage.haskell.org/package/wl-pprint [Hackage]: http://hackage.haskell.org/package/language-thrift [here]: http://abhinavg.net/language-thrift/
+ examples/reformatIDL.hs view
@@ -0,0 +1,25 @@+{-# LANGUAGE OverloadedStrings #-}+module Main (main) where++-- This program reads Thrift IDLs from stdin and writes their reformatted+-- versions back to stdout.+--+-- Docstrings in the IDL are preserved but COMMENTS WILL BE LOST.++import System.IO (stderr)+import Text.Trifecta (Result (..), parseString)+import Text.Trifecta.Delta (Delta (Directed))+import Text.PrettyPrint.Leijen (putDoc)++import qualified Text.PrettyPrint.ANSI.Leijen as AnsiPP++import Language.Thrift.Pretty (prettyPrint)+import Language.Thrift.Parser.Trifecta (thriftIDL)++main :: IO ()+main = do+ result <- parseString thriftIDL (Directed "stdin" 0 0 0 0) <$> getContents+ case result of+ Success p -> putDoc (prettyPrint p) >> putStrLn ""+ Failure doc ->+ AnsiPP.displayIO stderr $ AnsiPP.renderPretty 0.8 80 doc
language-thrift.cabal view
@@ -1,6 +1,6 @@ name : language-thrift-version : 0.3.0.0-synopsis : Parser for the Thrift IDL format.+version : 0.4.0.0+synopsis : Parser and pretty printer for the Thrift IDL format. homepage : https://github.com/abhinav/language-thrift license : BSD3 license-file : LICENSE@@ -10,7 +10,7 @@ build-type : Simple cabal-version : >=1.10 description :- This package provides a parser for the+ This package provides a parser and pretty printer for the <http://thrift.apache.org/docs/idl Thrift IDL format>. extra-source-files: README.md@@ -20,12 +20,31 @@ library exposed-modules : Language.Thrift.Parser , Language.Thrift.Parser.Trifecta+ , Language.Thrift.Pretty , Language.Thrift.Types- build-depends : base >= 4.7 && < 4.9+ build-depends : base >= 4.7 && < 4.9 , mtl- , text >= 1.2- , parsers >= 0.12 && < 0.13- , trifecta >= 1.5 && < 1.6+ , text >= 1.2+ , parsers >= 0.12 && < 0.13+ , trifecta >= 1.5 && < 1.6+ , wl-pprint >= 1.1+ default-language : Haskell2010+++test-suite spec+ type : exitcode-stdio-1.0+ hs-source-dirs : test+ main-is : Spec.hs+ other-modules : Language.Thrift.TypesSpec+ build-depends : base+ , hspec >= 2.0+ , hspec-discover >= 2.1+ , QuickCheck >= 2.5+ , text+ , trifecta+ , wl-pprint++ , language-thrift default-language : Haskell2010 source-repository head
+ test/Language/Thrift/TypesSpec.hs view
@@ -0,0 +1,283 @@+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE ScopedTypeVariables #-}+module Language.Thrift.TypesSpec where++#if __GLASGOW_HASKELL__ < 709+import Control.Applicative+#endif++import Control.Monad (unless)+import Data.Text (Text)+import Test.Hspec+import Test.Hspec.QuickCheck+import Test.QuickCheck+import Text.PrettyPrint.Leijen (Doc)++import Text.Trifecta (parseString)+import Text.Trifecta.Delta (Delta (..))++import qualified Data.Text as Text+import qualified Text.Trifecta as Tri++import qualified Language.Thrift.Parser as P+import qualified Language.Thrift.Pretty as PP+import qualified Language.Thrift.Types as T+++-- | Halve the maximum size of generated values.+--+-- Generally speaking, it's a good idea to use this for calls that will+-- recursively generate lists of things so that they terminate at some point.+halfSize :: Gen a -> Gen a+halfSize = scale (\n -> truncate (fromIntegral n / 2 :: Double))++newtype Identifier = Identifier { getIdentifier :: Text }++instance Arbitrary Identifier where+ arbitrary = Identifier . Text.pack <$> listOf1 (elements charset)+ where+ charset = ['a'..'z'] ++ ['A'..'Z']++newtype Docstring = Docstring { getDocstring :: Maybe Text }++instance Arbitrary Docstring where+ arbitrary = Docstring <$> oneof [return Nothing, comment]+ where+ commentLine =+ Text.unwords <$> listOf (getIdentifier <$> arbitrary)+ comment = do+ s <- Text.strip . Text.unlines <$> listOf1 (halfSize commentLine)+ if Text.null s+ then return Nothing+ else return (Just s)+++instance Arbitrary (T.Program ()) where+ arbitrary = T.Program <$> arbitrary <*> arbitrary+++instance Arbitrary (T.Definition ()) where+ arbitrary = oneof [arbitraryConst, arbitraryType, arbitraryService]+ where+ arbitraryConst =+ T.ConstDefinition+ <$> arbitrary+ <*> (getIdentifier <$> arbitrary)+ <*> arbitrary+ <*> (getDocstring <$> arbitrary)+ <*> pure ()++ arbitraryType =+ T.TypeDefinition+ <$> arbitrary+ <*> arbitrary++ arbitraryService =+ T.ServiceDefinition+ <$> (getIdentifier <$> arbitrary)+ <*> (fmap getIdentifier <$> arbitrary)+ <*> arbitrary+ <*> arbitrary+ <*> (getDocstring <$> arbitrary)+ <*> pure ()+++instance Arbitrary T.Header where+ arbitrary = oneof+ [ T.Include <$> (getIdentifier <$> arbitrary)+ , T.Namespace <$> elements scopes+ <*> (getIdentifier <$> arbitrary)+ ]+ where+ scopes = ["py", "rb", "java", "hs", "cpp"]+++instance Arbitrary (T.Field ()) where+ arbitrary =+ T.Field+ <$> (fmap getPositive <$> arbitrary)+ <*> arbitrary+ <*> halfSize arbitrary+ <*> (getIdentifier <$> arbitrary)+ <*> halfSize arbitrary+ <*> arbitrary+ <*> (getDocstring <$> arbitrary)+ <*> pure ()+++instance Arbitrary (T.Function ()) where+ arbitrary =+ T.Function+ <$> elements [True, False]+ <*> arbitrary+ <*> (getIdentifier <$> arbitrary)+ <*> arbitrary+ <*> arbitrary+ <*> arbitrary+ <*> (getDocstring <$> arbitrary)+ <*> pure ()+++instance Arbitrary T.TypeAnnotation where+ arbitrary =+ T.TypeAnnotation+ <$> (getIdentifier <$> arbitrary)+ <*> (getIdentifier <$> arbitrary)+++instance Arbitrary (T.EnumDef ()) where+ arbitrary =+ T.EnumDef+ <$> (getIdentifier <$> arbitrary)+ <*> arbitrary+ <*> arbitrary+ <*> (getDocstring <$> arbitrary)+ <*> pure ()+++instance Arbitrary (T.Type ()) where+ arbitrary = oneof+ [ T.Typedef+ <$> arbitrary+ <*> (getIdentifier <$> arbitrary)+ <*> (getDocstring <$> arbitrary)+ <*> pure ()+ , T.Enum+ <$> (getIdentifier <$> arbitrary)+ <*> arbitrary+ <*> (getDocstring <$> arbitrary)+ <*> pure ()+ , T.Struct+ <$> (getIdentifier <$> arbitrary)+ <*> arbitrary+ <*> (getDocstring <$> arbitrary)+ <*> pure ()+ , T.Union+ <$> (getIdentifier <$> arbitrary)+ <*> arbitrary+ <*> (getDocstring <$> arbitrary)+ <*> pure ()+ , T.Exception+ <$> (getIdentifier <$> arbitrary)+ <*> arbitrary+ <*> (getDocstring <$> arbitrary)+ <*> pure ()+ , T.Senum+ <$> (getIdentifier <$> arbitrary)+ <*> (map getIdentifier <$> arbitrary)+ <*> (getDocstring <$> arbitrary)+ <*> pure ()+ ]+++instance Arbitrary (T.FieldRequiredness) where+ arbitrary = elements [T.Required, T.Optional]++instance Arbitrary T.FieldType where+ arbitrary = oneof+ [ T.DefinedType . getIdentifier <$> arbitrary++ , T.StringType <$> arbitrary+ , T.BinaryType <$> arbitrary+ , T.SListType <$> arbitrary+ , T.BoolType <$> arbitrary+ , T.ByteType <$> arbitrary+ , T.I16Type <$> arbitrary+ , T.I32Type <$> arbitrary+ , T.I64Type <$> arbitrary+ , T.DoubleType <$> arbitrary++ , halfSize $+ T.MapType <$> arbitrary <*> arbitrary <*> arbitrary+ , halfSize $+ T.SetType <$> arbitrary <*> arbitrary+ , halfSize $+ T.ListType <$> arbitrary <*> arbitrary+ ]+++newtype BasicConstValue = BasicConstValue {+ getBasicConstValue :: T.ConstValue+ }+++instance Arbitrary BasicConstValue where+ arbitrary = BasicConstValue <$> oneof+ [ T.ConstFloat <$> choose (0.0, 10000.0)+ , T.ConstInt <$> arbitrary+ , T.ConstLiteral . getIdentifier <$> arbitrary+ , T.ConstIdentifier . getIdentifier <$> arbitrary+ ]++-- | newtype wrapper around const values so that we're not generating lists+-- and maps that go on forever.+newtype FiniteConstValue =+ FiniteConstValue { getFiniteConstValue :: T.ConstValue }+++instance Arbitrary FiniteConstValue where+ arbitrary = FiniteConstValue <$> oneof+ [ basicConsts+ , T.ConstList <$> constList+ , T.ConstMap <$> constMap+ ]+ where+ basicConsts = getBasicConstValue <$> arbitrary+ constList+ = listOf $ halfSize $ getFiniteConstValue <$> arbitrary+ constMap+ = listOf $+ (,) <$> basicConsts+ <*> halfSize (getFiniteConstValue <$> arbitrary)+++instance Arbitrary T.ConstValue where+ arbitrary = getFiniteConstValue <$> arbitrary+++spec :: Spec+spec =+ describe "Can round trip" $ do++ prop "field types" $+ roundtrip PP.fieldType P.fieldType++ prop "constant values" $+ roundtrip PP.constantValue P.constantValue++ prop "functions" $+ roundtrip PP.function (Tri.whiteSpace *> P.function)++ prop "definitions" $+ roundtrip PP.definition (Tri.whiteSpace *> P.definition)++ prop "headers" $+ roundtrip (const PP.header) P.header++ prop "documents" $+ roundtrip PP.program P.program+++roundtrip+ :: (Show a, Eq a)+ => (PP.Config -> a -> Doc)+ -> P.ThriftParser Tri.Parser () a+ -> a+ -> IO ()+roundtrip printer parser value = do+ let pretty = show . printer (PP.Config 4)+ triParser = P.runThriftParser (return ()) parser+ result =+ parseString triParser (Directed "memory" 0 0 0 0) (pretty value)+ case result of+ Tri.Success parsed ->+ unless (parsed == value) $ expectationFailure $+ "expected: " ++ show value ++ "\n but got: " ++ show parsed +++ "\n\n expected (pretty): " ++ pretty value +++ "\n but got (pretty): " ++ pretty parsed+ Tri.Failure msg -> expectationFailure $+ "failed to parse " ++ pretty value +++ "\n with " ++ show msg
+ test/Spec.hs view
@@ -0,0 +1,1 @@+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}