-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Avro serialization support for Haskell
--   
--   Avro serialization and deserialization support for Haskell
@package avro
@version 0.3.2.0

module Data.Avro.Types
data Value f
Null :: Value f
Boolean :: !Bool -> Value f
Int :: {-# UNPACK #-} !Int32 -> Value f
Long :: {-# UNPACK #-} !Int64 -> Value f
Float :: {-# UNPACK #-} !Float -> Value f
Double :: {-# UNPACK #-} !Double -> Value f
Bytes :: {-# UNPACK #-} !ByteString -> Value f
String :: {-# UNPACK #-} !Text -> Value f

-- | Dynamically enforced monomorphic type.
Array :: (Vector (Value f)) -> Value f

-- | Dynamically enforced monomorphic type
Map :: (HashMap Text (Value f)) -> Value f
Record :: f -> (HashMap Text (Value f)) -> Value f

-- | Set of union options, schema for selected option, and the actual
--   value.
Union :: (NonEmpty f) -> f -> (Value f) -> Value f
Fixed :: f -> {-# UNPACK #-} !ByteString -> Value f

-- | An enum is a set of the possible symbols (the schema) and the selected
--   symbol
Enum :: f -> {-# UNPACK #-} !Int -> Text -> Value f
instance GHC.Show.Show f => GHC.Show.Show (Data.Avro.Types.Value f)
instance GHC.Classes.Eq f => GHC.Classes.Eq (Data.Avro.Types.Value f)


-- | Avro <a>Schema</a>s, represented here as values of type <a>Schema</a>,
--   describe the serialization and de-serialization of values.
--   
--   In Avro schemas are compose-able such that encoding data under a
--   schema and decoding with a variant, such as newer or older version of
--   the original schema, can be accomplished by using the
--   <a>Deconflict</a> module.
module Data.Avro.Schema

-- | An Avro schema is either * A "JSON object in the form
--   `{"type":"typeName" ...` * A "JSON string, naming a defined type"
--   (basic type w<i>o free variables</i>names) * A "JSON array,
--   representing a union"
--   
--   N.B. It is possible to create a Haskell value (of Schema type) that is
--   not a valid Avro schema by violating one of the above or one of the
--   conditions called out in <a>validateSchema</a>.
type Schema = Type

-- | Avro types are considered either primitive (string, int, etc) or
--   complex/declared (structures, unions etc).
data Type
Null :: Type
Boolean :: Type
Int :: Type
Long :: Type
Float :: Type
Double :: Type
Bytes :: Type
String :: Type
Array :: Type -> Type
[item] :: Type -> Type
Map :: Type -> Type
[values] :: Type -> Type
NamedType :: TypeName -> Type
Record :: TypeName -> Maybe Text -> [TypeName] -> Maybe Text -> Maybe Order -> [Field] -> Type
[name] :: Type -> TypeName
[namespace] :: Type -> Maybe Text
[aliases] :: Type -> [TypeName]
[doc] :: Type -> Maybe Text
[order] :: Type -> Maybe Order
[fields] :: Type -> [Field]
Enum :: TypeName -> Maybe Text -> [TypeName] -> Maybe Text -> [Text] -> Int64 -> Maybe Text -> Type
[name] :: Type -> TypeName
[namespace] :: Type -> Maybe Text
[aliases] :: Type -> [TypeName]
[doc] :: Type -> Maybe Text
[symbols] :: Type -> [Text]
[symbolLookup] :: Type -> Int64 -> Maybe Text
Union :: NonEmpty Type -> Int64 -> Maybe Type -> Type
[options] :: Type -> NonEmpty Type
[unionLookup] :: Type -> Int64 -> Maybe Type
Fixed :: TypeName -> Maybe Text -> [TypeName] -> Int -> Type
[name] :: Type -> TypeName
[namespace] :: Type -> Maybe Text
[aliases] :: Type -> [TypeName]
[size] :: Type -> Int
data Field
Field :: Text -> [Text] -> Maybe Text -> Maybe Order -> Type -> Maybe (Value Type) -> Field
[fldName] :: Field -> Text
[fldAliases] :: Field -> [Text]
[fldDoc] :: Field -> Maybe Text
[fldOrder] :: Field -> Maybe Order
[fldType] :: Field -> Type
[fldDefault] :: Field -> Maybe (Value Type)
data Order
Ascending :: Order
Descending :: Order
Ignore :: Order
newtype TypeName
TN :: Text -> TypeName
[unTN] :: TypeName -> Text

-- | <tt>mkEnum name aliases namespace docs syms</tt> Constructs an
--   <a>Enum</a> schema using the enumeration type's name, aliases (if
--   any), namespace, documentation, and list of symbols that inhabit the
--   enumeration.
mkEnum :: TypeName -> [TypeName] -> Maybe Text -> Maybe Text -> [Text] -> Type

-- | <tt>mkUnion subTypes</tt> Defines a union of the provided subTypes.
--   N.B. it is invalid Avro to include another union or to have more than
--   one of the same type as a direct member of the union. No check is done
--   for this condition!
mkUnion :: NonEmpty Type -> Type

-- | Placeholder NO-OP function!
--   
--   Validates a schema to ensure:
--   
--   <ul>
--   <li>All types are defined</li>
--   <li>Unions do not directly contain other unions</li>
--   <li>Unions are not ambiguous (may not contain more than one schema
--   with the same type except for named types of record, fixed and
--   enum)</li>
--   <li>Default values for unions can be cast as the type indicated by the
--   first structure.</li>
--   <li>Default values can be cast/de-serialize correctly.</li>
--   <li>Named types are resolvable</li>
--   </ul>
validateSchema :: Schema -> Parser ()

-- | Get the name of the type. In the case of unions, get the name of the
--   first value in the union schema.
typeName :: Type -> Text

-- | <tt>buildTypeEnvironment schema</tt> builds a function mapping type
--   names to the types declared in the traversed schema. Notice this
--   function does not currently handle namespaces in a correct manner,
--   possibly allowing for bad environment lookups when used on complex
--   schemas.
buildTypeEnvironment :: Applicative m => (TypeName -> m Type) -> Type -> TypeName -> m Type
data Result a
Success :: a -> Result a
Error :: String -> Result a

-- | Checks that two schemas match. This is like equality of schemas,
--   except <tt>NamedTypes</tt> match against other types <i>with the same
--   name</i>.
--   
--   This extends recursively: two records match if they have the same
--   name, the same number of fields and the fields all match.
matches :: Type -> Type -> Bool

-- | Parses a string literal into a bytestring in the format expected for
--   bytes and fixed values. Will fail if every character does not have a
--   codepoint between 0 and 255.
parseBytes :: Text -> Result ByteString

-- | Turn a <tt>ByteString</tt> into a <a>Text</a> that matches the format
--   Avro expects from bytes and fixed literals in JSON. Each byte is
--   mapped to a single Unicode codepoint between 0 and 255.
serializeBytes :: ByteString -> Text

-- | Parse JSON-encoded avro data.
parseAvroJSON :: (Type -> Value -> Result (Value Type)) -> (Text -> Maybe Type) -> Type -> Value -> Result (Value Type)
instance GHC.Show.Show a => GHC.Show.Show (Data.Avro.Schema.Result a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Avro.Schema.Result a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Avro.Schema.Result a)
instance GHC.Show.Show Data.Avro.Schema.Field
instance GHC.Classes.Eq Data.Avro.Schema.Field
instance GHC.Show.Show Data.Avro.Schema.Type
instance GHC.Show.Show Data.Avro.Schema.Order
instance GHC.Classes.Ord Data.Avro.Schema.Order
instance GHC.Classes.Eq Data.Avro.Schema.Order
instance GHC.Classes.Ord Data.Avro.Schema.TypeName
instance GHC.Classes.Eq Data.Avro.Schema.TypeName
instance Data.Aeson.Types.FromJSON.FromJSON Data.Avro.Schema.Field
instance GHC.Base.Monad Data.Avro.Schema.Result
instance GHC.Base.Functor Data.Avro.Schema.Result
instance Control.Monad.Fail.MonadFail Data.Avro.Schema.Result
instance Control.Monad.Error.Class.MonadError GHC.Base.String Data.Avro.Schema.Result
instance GHC.Base.Applicative Data.Avro.Schema.Result
instance GHC.Base.Alternative Data.Avro.Schema.Result
instance GHC.Base.MonadPlus Data.Avro.Schema.Result
instance GHC.Base.Semigroup (Data.Avro.Schema.Result a)
instance GHC.Base.Monoid (Data.Avro.Schema.Result a)
instance Data.Foldable.Foldable Data.Avro.Schema.Result
instance Data.Traversable.Traversable Data.Avro.Schema.Result
instance GHC.Classes.Eq Data.Avro.Schema.Type
instance Data.Aeson.Types.FromJSON.FromJSON Data.Avro.Schema.Type
instance Data.Aeson.Types.ToJSON.ToJSON Data.Avro.Schema.Type
instance Data.Aeson.Types.ToJSON.ToJSON Data.Avro.Schema.Field
instance Data.Aeson.Types.ToJSON.ToJSON (Data.Avro.Types.Value Data.Avro.Schema.Type)
instance Data.Aeson.Types.ToJSON.ToJSON Data.Avro.Schema.Order
instance Data.Aeson.Types.FromJSON.FromJSON Data.Avro.Schema.Order
instance GHC.Show.Show Data.Avro.Schema.TypeName
instance GHC.Base.Semigroup Data.Avro.Schema.TypeName
instance GHC.Base.Monoid Data.Avro.Schema.TypeName
instance Data.String.IsString Data.Avro.Schema.TypeName
instance Data.Hashable.Class.Hashable Data.Avro.Schema.TypeName
instance Data.Aeson.Types.ToJSON.ToJSON Data.Avro.Schema.TypeName
instance Data.Aeson.Types.FromJSON.FromJSON Data.Avro.Schema.TypeName

module Data.Avro.HasAvroSchema
class HasAvroSchema a
schema :: HasAvroSchema a => Tagged a Type
schemaOf :: (HasAvroSchema a) => a -> Type
wrapTag :: (Type -> Type) -> Tagged a Type -> Tagged b Type
instance Data.Avro.HasAvroSchema.HasAvroSchema GHC.Word.Word8
instance Data.Avro.HasAvroSchema.HasAvroSchema GHC.Word.Word16
instance Data.Avro.HasAvroSchema.HasAvroSchema GHC.Word.Word32
instance Data.Avro.HasAvroSchema.HasAvroSchema GHC.Word.Word64
instance Data.Avro.HasAvroSchema.HasAvroSchema GHC.Types.Bool
instance Data.Avro.HasAvroSchema.HasAvroSchema ()
instance Data.Avro.HasAvroSchema.HasAvroSchema GHC.Types.Int
instance Data.Avro.HasAvroSchema.HasAvroSchema GHC.Int.Int8
instance Data.Avro.HasAvroSchema.HasAvroSchema GHC.Int.Int16
instance Data.Avro.HasAvroSchema.HasAvroSchema GHC.Int.Int32
instance Data.Avro.HasAvroSchema.HasAvroSchema GHC.Int.Int64
instance Data.Avro.HasAvroSchema.HasAvroSchema GHC.Types.Double
instance Data.Avro.HasAvroSchema.HasAvroSchema GHC.Types.Float
instance Data.Avro.HasAvroSchema.HasAvroSchema Data.Text.Internal.Text
instance Data.Avro.HasAvroSchema.HasAvroSchema Data.Text.Internal.Lazy.Text
instance Data.Avro.HasAvroSchema.HasAvroSchema Data.ByteString.Internal.ByteString
instance Data.Avro.HasAvroSchema.HasAvroSchema Data.ByteString.Lazy.Internal.ByteString
instance (Data.Avro.HasAvroSchema.HasAvroSchema a, Data.Avro.HasAvroSchema.HasAvroSchema b) => Data.Avro.HasAvroSchema.HasAvroSchema (Data.Either.Either a b)
instance Data.Avro.HasAvroSchema.HasAvroSchema a => Data.Avro.HasAvroSchema.HasAvroSchema (Data.Map.Internal.Map Data.Text.Internal.Text a)
instance Data.Avro.HasAvroSchema.HasAvroSchema a => Data.Avro.HasAvroSchema.HasAvroSchema (Data.HashMap.Base.HashMap Data.Text.Internal.Text a)
instance Data.Avro.HasAvroSchema.HasAvroSchema a => Data.Avro.HasAvroSchema.HasAvroSchema (Data.Map.Internal.Map Data.Text.Internal.Lazy.Text a)
instance Data.Avro.HasAvroSchema.HasAvroSchema a => Data.Avro.HasAvroSchema.HasAvroSchema (Data.HashMap.Base.HashMap Data.Text.Internal.Lazy.Text a)
instance Data.Avro.HasAvroSchema.HasAvroSchema a => Data.Avro.HasAvroSchema.HasAvroSchema (Data.Map.Internal.Map GHC.Base.String a)
instance Data.Avro.HasAvroSchema.HasAvroSchema a => Data.Avro.HasAvroSchema.HasAvroSchema (Data.HashMap.Base.HashMap GHC.Base.String a)
instance Data.Avro.HasAvroSchema.HasAvroSchema a => Data.Avro.HasAvroSchema.HasAvroSchema (GHC.Base.Maybe a)
instance Data.Avro.HasAvroSchema.HasAvroSchema a => Data.Avro.HasAvroSchema.HasAvroSchema [a]
instance (Data.Avro.HasAvroSchema.HasAvroSchema a, GHC.Arr.Ix i) => Data.Avro.HasAvroSchema.HasAvroSchema (GHC.Arr.Array i a)
instance Data.Avro.HasAvroSchema.HasAvroSchema a => Data.Avro.HasAvroSchema.HasAvroSchema (Data.Vector.Vector a)
instance Data.Avro.HasAvroSchema.HasAvroSchema a => Data.Avro.HasAvroSchema.HasAvroSchema (Data.Vector.Unboxed.Base.Vector a)
instance Data.Avro.HasAvroSchema.HasAvroSchema a => Data.Avro.HasAvroSchema.HasAvroSchema (Data.Set.Internal.Set a)

module Data.Avro.ToAvro
class HasAvroSchema a => ToAvro a
toAvro :: ToAvro a => a -> Value Type
(.=) :: ToAvro a => Text -> a -> (Text, Value Type)
instance Data.Avro.ToAvro.ToAvro GHC.Types.Bool
instance Data.Avro.ToAvro.ToAvro ()
instance Data.Avro.ToAvro.ToAvro GHC.Types.Int
instance Data.Avro.ToAvro.ToAvro GHC.Int.Int32
instance Data.Avro.ToAvro.ToAvro GHC.Int.Int64
instance Data.Avro.ToAvro.ToAvro GHC.Types.Double
instance Data.Avro.ToAvro.ToAvro GHC.Types.Float
instance Data.Avro.ToAvro.ToAvro Data.Text.Internal.Text
instance Data.Avro.ToAvro.ToAvro Data.Text.Internal.Lazy.Text
instance Data.Avro.ToAvro.ToAvro Data.ByteString.Internal.ByteString
instance Data.Avro.ToAvro.ToAvro Data.ByteString.Lazy.Internal.ByteString
instance (Data.Avro.ToAvro.ToAvro a, Data.Avro.ToAvro.ToAvro b) => Data.Avro.ToAvro.ToAvro (Data.Either.Either a b)
instance Data.Avro.ToAvro.ToAvro a => Data.Avro.ToAvro.ToAvro (Data.Map.Internal.Map Data.Text.Internal.Text a)
instance Data.Avro.ToAvro.ToAvro a => Data.Avro.ToAvro.ToAvro (Data.HashMap.Base.HashMap Data.Text.Internal.Text a)
instance Data.Avro.ToAvro.ToAvro a => Data.Avro.ToAvro.ToAvro (Data.Map.Internal.Map Data.Text.Internal.Lazy.Text a)
instance Data.Avro.ToAvro.ToAvro a => Data.Avro.ToAvro.ToAvro (Data.HashMap.Base.HashMap Data.Text.Internal.Lazy.Text a)
instance Data.Avro.ToAvro.ToAvro a => Data.Avro.ToAvro.ToAvro (Data.Map.Internal.Map GHC.Base.String a)
instance Data.Avro.ToAvro.ToAvro a => Data.Avro.ToAvro.ToAvro (Data.HashMap.Base.HashMap GHC.Base.String a)
instance Data.Avro.ToAvro.ToAvro a => Data.Avro.ToAvro.ToAvro (GHC.Base.Maybe a)
instance Data.Avro.ToAvro.ToAvro a => Data.Avro.ToAvro.ToAvro [a]

module Data.Avro.Deconflict

-- | <tt>deconflict writer reader val</tt> will convert a value that was
--   encoded/decoded with the writer's schema into the form specified by
--   the reader's schema.
deconflict :: Schema -> Schema -> Value Type -> Either String (Value Type)

module Data.Avro.Zag
class Zag a where {
    type family Zagged a;
}
zag :: Zag a => a -> Zagged a
instance Data.Avro.Zag.Zag GHC.Word.Word8
instance Data.Avro.Zag.Zag GHC.Word.Word16
instance Data.Avro.Zag.Zag GHC.Word.Word32
instance Data.Avro.Zag.Zag GHC.Word.Word64
instance Data.Avro.Zag.Zag GHC.Types.Word

module Data.Avro.DecodeRaw
class DecodeRaw a
decodeRaw :: DecodeRaw a => Get a
instance Data.Avro.DecodeRaw.DecodeRaw GHC.Types.Word
instance Data.Avro.DecodeRaw.DecodeRaw GHC.Word.Word8
instance Data.Avro.DecodeRaw.DecodeRaw GHC.Word.Word16
instance Data.Avro.DecodeRaw.DecodeRaw GHC.Word.Word32
instance Data.Avro.DecodeRaw.DecodeRaw GHC.Word.Word64
instance Data.Avro.DecodeRaw.DecodeRaw GHC.Types.Int
instance Data.Avro.DecodeRaw.DecodeRaw GHC.Int.Int8
instance Data.Avro.DecodeRaw.DecodeRaw GHC.Int.Int16
instance Data.Avro.DecodeRaw.DecodeRaw GHC.Int.Int32
instance Data.Avro.DecodeRaw.DecodeRaw GHC.Int.Int64

module Data.Avro.Decode

-- | Decode bytes into a <tt>Value</tt> as described by Schema.
decodeAvro :: Schema -> ByteString -> Either String (Value Type)
decodeContainer :: ByteString -> Either String (Schema, [[Value Type]])
decodeContainerWith :: (Schema -> Get a) -> ByteString -> Either String (Schema, [[a]])
getAvroOf :: Schema -> Get (Value Type)
class GetAvro a
getAvro :: GetAvro a => Get a
instance Data.Avro.Decode.GetAvro Data.Avro.Decode.ContainerHeader
instance Data.Avro.Decode.GetAvro ty => Data.Avro.Decode.GetAvro (Data.Map.Internal.Map Data.Text.Internal.Text ty)
instance Data.Avro.Decode.GetAvro GHC.Types.Bool
instance Data.Avro.Decode.GetAvro GHC.Int.Int32
instance Data.Avro.Decode.GetAvro GHC.Int.Int64
instance Data.Avro.Decode.GetAvro Data.ByteString.Lazy.Internal.ByteString
instance Data.Avro.Decode.GetAvro Data.ByteString.Internal.ByteString
instance Data.Avro.Decode.GetAvro Data.Text.Internal.Text
instance Data.Avro.Decode.GetAvro GHC.Types.Float
instance Data.Avro.Decode.GetAvro GHC.Types.Double
instance Data.Avro.Decode.GetAvro GHC.Base.String
instance Data.Avro.Decode.GetAvro a => Data.Avro.Decode.GetAvro [a]
instance Data.Avro.Decode.GetAvro a => Data.Avro.Decode.GetAvro (GHC.Base.Maybe a)
instance Data.Avro.Decode.GetAvro a => Data.Avro.Decode.GetAvro (GHC.Arr.Array GHC.Types.Int a)
instance Data.Avro.Decode.GetAvro a => Data.Avro.Decode.GetAvro (Data.Vector.Vector a)
instance (Data.Avro.Decode.GetAvro a, GHC.Classes.Ord a) => Data.Avro.Decode.GetAvro (Data.Set.Internal.Set a)

module Data.Avro.Zig
class Zig a where {
    type family Zigged a;
}
zig :: Zig a => a -> Zigged a
instance Data.Avro.Zig.Zig GHC.Int.Int8
instance Data.Avro.Zig.Zig GHC.Int.Int16
instance Data.Avro.Zig.Zig GHC.Int.Int32
instance Data.Avro.Zig.Zig GHC.Int.Int64
instance Data.Avro.Zig.Zig GHC.Types.Int

module Data.Avro.EncodeRaw
class EncodeRaw a
encodeRaw :: EncodeRaw a => a -> Builder
instance Data.Avro.EncodeRaw.EncodeRaw GHC.Types.Word
instance Data.Avro.EncodeRaw.EncodeRaw GHC.Word.Word8
instance Data.Avro.EncodeRaw.EncodeRaw GHC.Word.Word16
instance Data.Avro.EncodeRaw.EncodeRaw GHC.Word.Word32
instance Data.Avro.EncodeRaw.EncodeRaw GHC.Word.Word64
instance Data.Avro.EncodeRaw.EncodeRaw GHC.Types.Int
instance Data.Avro.EncodeRaw.EncodeRaw GHC.Int.Int8
instance Data.Avro.EncodeRaw.EncodeRaw GHC.Int.Int16
instance Data.Avro.EncodeRaw.EncodeRaw GHC.Int.Int32
instance Data.Avro.EncodeRaw.EncodeRaw GHC.Int.Int64

module Data.Avro.Encode
getSchema :: forall a. EncodeAvro a => a -> Schema
encodeAvro :: EncodeAvro a => a -> ByteString

-- | Encode chunks of objects into a container, using 16 random bytes for
--   the synchronization markers.
encodeContainer :: EncodeAvro a => Schema -> [[a]] -> IO ByteString

-- | Encode chunks of objects into a container, using the provided
--   ByteString as the synchronization markers.
encodeContainerWithSync :: EncodeAvro a => Schema -> ByteString -> [[a]] -> ByteString
class EncodeAvro a
avro :: EncodeAvro a => a -> AvroM
class Zag a where {
    type family Zagged a;
}
zag :: Zag a => a -> Zagged a
putAvro :: EncodeAvro a => a -> Builder
instance Data.Avro.Encode.EncodeAvro GHC.Types.Int
instance Data.Avro.Encode.EncodeAvro GHC.Int.Int8
instance Data.Avro.Encode.EncodeAvro GHC.Int.Int16
instance Data.Avro.Encode.EncodeAvro GHC.Int.Int32
instance Data.Avro.Encode.EncodeAvro GHC.Int.Int64
instance Data.Avro.Encode.EncodeAvro GHC.Word.Word8
instance Data.Avro.Encode.EncodeAvro GHC.Word.Word16
instance Data.Avro.Encode.EncodeAvro GHC.Word.Word32
instance Data.Avro.Encode.EncodeAvro GHC.Word.Word64
instance Data.Avro.Encode.EncodeAvro Data.Text.Internal.Text
instance Data.Avro.Encode.EncodeAvro Data.Text.Internal.Lazy.Text
instance Data.Avro.Encode.EncodeAvro Data.ByteString.Lazy.Internal.ByteString
instance Data.Avro.Encode.EncodeAvro Data.ByteString.Internal.ByteString
instance Data.Avro.Encode.EncodeAvro GHC.Base.String
instance Data.Avro.Encode.EncodeAvro GHC.Types.Double
instance Data.Avro.Encode.EncodeAvro GHC.Types.Float
instance Data.Avro.Encode.EncodeAvro a => Data.Avro.Encode.EncodeAvro [a]
instance (GHC.Arr.Ix i, Data.Avro.Encode.EncodeAvro a) => Data.Avro.Encode.EncodeAvro (GHC.Arr.Array i a)
instance Data.Avro.Encode.EncodeAvro a => Data.Avro.Encode.EncodeAvro (Data.Vector.Vector a)
instance (Data.Vector.Unboxed.Base.Unbox a, Data.Avro.Encode.EncodeAvro a) => Data.Avro.Encode.EncodeAvro (Data.Vector.Unboxed.Base.Vector a)
instance Data.Avro.Encode.EncodeAvro a => Data.Avro.Encode.EncodeAvro (Data.Set.Internal.Set a)
instance Data.Avro.Encode.EncodeAvro a => Data.Avro.Encode.EncodeAvro (Data.HashMap.Base.HashMap Data.Text.Internal.Text a)
instance Data.Avro.Encode.EncodeAvro a => Data.Avro.Encode.EncodeAvro (GHC.Base.Maybe a)
instance Data.Avro.Encode.EncodeAvro ()
instance Data.Avro.Encode.EncodeAvro GHC.Types.Bool
instance Data.Avro.Encode.EncodeAvro (Data.Avro.Types.Value Data.Avro.Schema.Type)

module Data.Avro.FromAvro
class HasAvroSchema a => FromAvro a
fromAvro :: FromAvro a => Value Type -> Result a
(.:) :: FromAvro a => HashMap Text (Value Type) -> Text -> Result a
badValue :: Value Type -> String -> Result a
instance (Data.Avro.FromAvro.FromAvro a, Data.Avro.FromAvro.FromAvro b) => Data.Avro.FromAvro.FromAvro (Data.Either.Either a b)
instance Data.Avro.FromAvro.FromAvro GHC.Types.Bool
instance Data.Avro.FromAvro.FromAvro Data.ByteString.Internal.ByteString
instance Data.Avro.FromAvro.FromAvro Data.ByteString.Lazy.Internal.ByteString
instance Data.Avro.FromAvro.FromAvro GHC.Types.Int
instance Data.Avro.FromAvro.FromAvro GHC.Int.Int32
instance Data.Avro.FromAvro.FromAvro GHC.Int.Int64
instance Data.Avro.FromAvro.FromAvro GHC.Types.Double
instance Data.Avro.FromAvro.FromAvro GHC.Types.Float
instance Data.Avro.FromAvro.FromAvro a => Data.Avro.FromAvro.FromAvro (GHC.Base.Maybe a)
instance Data.Avro.FromAvro.FromAvro a => Data.Avro.FromAvro.FromAvro [a]
instance Data.Avro.FromAvro.FromAvro Data.Text.Internal.Text
instance Data.Avro.FromAvro.FromAvro Data.Text.Internal.Lazy.Text
instance Data.Avro.FromAvro.FromAvro a => Data.Avro.FromAvro.FromAvro (Data.Map.Internal.Map Data.Text.Internal.Text a)
instance Data.Avro.FromAvro.FromAvro a => Data.Avro.FromAvro.FromAvro (Data.HashMap.Base.HashMap Data.Text.Internal.Text a)


-- | Avro encoding and decoding routines.
--   
--   This library provides a high level interface for encoding (and
--   decoding) Haskell values in Apache's Avro serialization format. The
--   goal is to match Aeson's API whenever reasonable, meaning user
--   experience with one effectively translate to the other.
--   
--   Avro RPC is not currently supported.
--   
--   <ul>
--   <li>*Library Structure**</li>
--   </ul>
--   
--   The library structure includes: * This module, <a>Avro</a>, providing
--   a high-level interface via classes of <a>FromAvro</a> and
--   <a>ToAvro</a> for decoding and encoding values. * <a>Type</a> define
--   the types of Avro data, providing a common (intermediate)
--   representation for any data that is encoded or decoded by Data.Avro. *
--   <a>Encode</a> and <a>Decode</a>: More efficient conversion capable of
--   avoiding the intermediate representation. Also, the implementation of
--   the en/decoding of the intermediate representation. *
--   <a>Deconflict</a>: translate decoded data from an encoder schema to
--   the (potentially different) decoder's schema. * <a>Schema</a>: Defines
--   the type for Avro schema's and its JSON encoding/decoding.
--   
--   Example decoding:
--   
--   Let's say you have an ADT and related schema:
--   
--   <pre>
--   {--}
--   import qualified Data.Avro.Types as Ty
--   import Data.Avro.Schema
--   import Data.Avro
--   import           Data.List.NonEmpty (NonEmpty(..))
--   
--   data MyEnum = A | B | C | D deriving (Eq,Ord,Show,Enum,Generic)
--   data MyStruct = MyStruct (Either MyEnum String) Int
--   
--   meSchema :: Schema
--   meSchema = Schema $ mkEnum <a>MyEnum</a> [] Nothing Nothing [<a>A</a>,<a>B</a>,<a>C</a>,<a>D</a>]
--   
--   msSchema  :: Schema
--   msSchema =
--     Struct <a>MyStruct</a> Nothing [] Nothing Nothing
--         [ fld "enumOrString" eOrS (Just $ String "The Default")
--         , fld "int" Int (Just (Ty.Int 1))
--         ]
--        where
--        fld nm ty def = Field nm [] Nothing Nothing ty def
--        eOrS = mkUnion (meSchema :| [String])
--   
--   instance ToAvro MyEnum where
--       toAvro = toAvroEnum
--   instance ToAvro MyStruct where
--       toAvro (MyStruct ab i) =
--        record [ "enumOrString" .= ab
--               , "int"          .= i
--               ]
--   
--   main = do
--     let val = MyStruct (Right <a>Hello</a>) 1
--     print (fromAvro (toAvro val) == Success val)
--   </pre>
module Data.Avro
class HasAvroSchema a => FromAvro a
fromAvro :: FromAvro a => Value Type -> Result a
class HasAvroSchema a => ToAvro a
toAvro :: ToAvro a => a -> Value Type
class HasAvroSchema a
schema :: HasAvroSchema a => Tagged a Type
type Avro a = (FromAvro a, ToAvro a)
(.:) :: FromAvro a => HashMap Text (Value Type) -> Text -> Result a
(.=) :: ToAvro a => Text -> a -> (Text, Value Type)
record :: Foldable f => Type -> f (Text, Value Type) -> Value Type
fixed :: Type -> ByteString -> Value Type
data Result a
Success :: a -> Result a
Error :: String -> Result a
badValue :: Value Type -> String -> Result a

-- | Decode a lazy bytestring using a Schema for the return type.
decode :: forall a. FromAvro a => ByteString -> Result a

-- | Decode a lazy bytestring with a provided schema
decodeWithSchema :: FromAvro a => Schema -> ByteString -> Result a

-- | Decode a container and de-conflict the writer schema with a reader
--   schema for a return type. Like in <a>decodeContainerWithSchema</a>
--   exceptions are thrown instead of a <a>Result</a> type to allow this
--   function to be read lazy (to be done in some later version).
decodeContainer :: forall a. FromAvro a => ByteString -> [[a]]

-- | Decode a container and de-conflict the writer schema with a given
--   reader-schema. Exceptions are thrown instead of a <a>Result</a> type
--   to allow this function to be read lazy (to be done in some later
--   version).
decodeContainerWithSchema :: FromAvro a => Schema -> ByteString -> [[a]]

-- | Like <a>decodeContainer</a> but returns the avro-encoded bytes for
--   each object in the container instead of the Haskell type.
--   
--   This is particularly useful when slicing up containers into one or
--   more smaller files. By extracting the original bytestring it is
--   possible to avoid re-encoding data.
decodeContainerBytes :: ByteString -> [[ByteString]]

-- | Encodes a value to a lazy ByteString
encode :: ToAvro a => a -> ByteString

-- | Encode chunks of objects into a container, using 16 random bytes for
--   the synchronization markers.
encodeContainer :: forall a. ToAvro a => [[a]] -> IO ByteString

-- | Encode chunks of objects into a container, using the provided
--   ByteString as the synchronization markers
encodeContainerWithSync :: forall a. ToAvro a => (Word64, Word64, Word64, Word64) -> [[a]] -> ByteString
schemaOf :: (HasAvroSchema a) => a -> Type


-- | Avro supports a JSON representation of Avro objects alongside the Avro
--   binary format. An Avro schema can be used to generate and validate
--   JSON representations of Avro objects.
--   
--   The JSON format is the same format as used for default values in
--   schemas except unions are encoded differently. Non-union values are
--   encoded as follows:
--   
--   TODO: table
--   
--   (Table from the Avro 1.8.2 specification:
--   <a>https://avro.apache.org/docs/1.8.2/spec.html#schema_record</a>)
--   
--   Bytes and fixed are encoded as JSON strings where each byte is
--   translated into the corresponding Unicode codepoint between 0–255,
--   which includes non-printable characters. Note that this encoding
--   happens at the Unicode code-point level, meaning it is independent of
--   text encoding. (JSON is, by definition, encoded in UTF8.)
--   
--   Unions are encoded as an object with a single field that specifies the
--   "branch" of the union. If the branch is a primitive type like
--   <tt>"string"</tt>, the name of the primitive type is used:
--   
--   <pre>
--   { "string" : "foo" }
--   </pre>
--   
--   For named types (record, enum and fixed), the name of the type is
--   used:
--   
--   <pre>
--   { <a>MyRecord</a> : { ... } }
--   </pre>
module Data.Avro.JSON

-- | Convert a <a>Value</a> into a type that has an Avro schema. The schema
--   is used to validate the JSON and will return an <a>Error</a> if the
--   JSON object is not encoded correctly or does not match the schema.
fromJSON :: forall a. (FromAvro a) => Value -> Result a

-- | Parse a <a>ByteString</a> as JSON and convert it to a type with an
--   Avro schema. Will return <a>Error</a> if the input is not valid JSON
--   or the JSON does not convert with the specified schema.
parseJSON :: forall a. (FromAvro a) => ByteString -> Result a

-- | Convert an object with an Avro schema to JSON using that schema.
--   
--   We always need the schema to <i>encode</i> to JSON because
--   representing unions requires using the names of named types.
toJSON :: forall a. (ToAvro a) => a -> Value

module Data.Avro.Deriving

-- | Derives Avro from a given schema file. Generates data types, FromAvro
--   and ToAvro instances.
data DeriveOptions
DeriveOptions :: TypeName -> Field -> Text -> DeriveOptions

-- | How to build field names for generated data types
[fieldNameBuilder] :: DeriveOptions -> TypeName -> Field -> Text

-- | Default deriving options
--   
--   <pre>
--   defaultDeriveOptions = <a>DeriveOptions</a>
--     { fieldNameBuilder = <a>mkPrefixedFieldName</a>
--     }
--   </pre>
defaultDeriveOptions :: DeriveOptions

-- | Generates a field name that is prefixed with the type name.
--   
--   For example, if the schema defines type <tt>Person</tt> that has a
--   field <tt>firstName</tt>, then the generated Haskell type will be like
--   
--   <pre>
--   Person { personFirstName :: Text }
--   </pre>
mkPrefixedFieldName :: TypeName -> Field -> Text

-- | Generates a field name that matches the field name in schema
--   (sanitised for Haskell, so first letter is lower cased)
--   
--   For example, if the schema defines type <tt>Person</tt> that has a
--   field <tt>firstName</tt>, then the generated Haskell type will be like
--   
--   <pre>
--   Person { firstName :: Text }
--   </pre>
--   
--   You may want to enable <a>DuplicateRecordFields</a> if you want to use
--   this method.
mkAsIsFieldName :: TypeName -> Field -> Text

-- | Generates the value of type <a>Schema</a> that it can later be used
--   with <a>deriveAvro'</a> or <a>deriveAvroWithOptions'</a>.
--   
--   <pre>
--   mySchema :: Schema
--   mySchema = $(makeSchema "schemas/my-schema.avsc")
--   </pre>
makeSchema :: FilePath -> Q Exp

-- | Generates Haskell classes and <a>FromAvro</a> and <a>ToAvro</a>
--   instances given the Avro schema file
deriveAvroWithOptions :: DeriveOptions -> FilePath -> Q [Dec]

-- | Generates Haskell classes and <a>FromAvro</a> and <a>ToAvro</a>
--   instances given the Avro schema
deriveAvroWithOptions' :: DeriveOptions -> Schema -> Q [Dec]

-- | Derives "read only" Avro from a given schema file. Generates data
--   types and FromAvro.
deriveFromAvroWithOptions :: DeriveOptions -> FilePath -> Q [Dec]

-- | Same as <a>deriveAvroWithOptions</a> but uses
--   <a>defaultDeriveOptions</a>
--   
--   <pre>
--   deriveAvro' = deriveAvroWithOptions' <a>defaultDeriveOptions</a>
--   </pre>
deriveAvro :: FilePath -> Q [Dec]

-- | Same as <a>deriveAvroWithOptions'</a> but uses
--   <a>defaultDeriveOptions</a>
--   
--   <pre>
--   deriveAvro' = <a>deriveAvroWithOptions'</a> <a>defaultDeriveOptions</a>
--   </pre>
deriveAvro' :: Schema -> Q [Dec]

-- | Derives "read only" Avro from a given schema file. Generates data
--   types and FromAvro.
deriveFromAvro :: FilePath -> Q [Dec]
instance GHC.Generics.Generic Data.Avro.Deriving.DeriveOptions
