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


-- | This package provides a newtype wrapper with FromJSON/ToJSON instances
--   customisable via a phantom type parameter. The instances can be
--   rendered to the original type using DerivingVia.
@package deriving-aeson
@version 0.2.10


-- | Type-directed aeson instance CustomJSONisation
module Deriving.Aeson

-- | A newtype wrapper which gives FromJSON/ToJSON instances with modified
--   options.
newtype CustomJSON (t :: k) a
CustomJSON :: a -> CustomJSON (t :: k) a
[unCustomJSON] :: CustomJSON (t :: k) a -> a

-- | Function applied to field labels. Handy for removing common record
--   prefixes for example.
data FieldLabelModifier (t :: k)

-- | Function applied to constructor tags which could be handy for
--   lower-casing them for example.
data ConstructorTagModifier (t :: k)

-- | Record fields with a Nothing value will be omitted from the resulting
--   object.
data OmitNothingFields

-- | JSON Documents mapped to records with unmatched keys will be rejected
data RejectUnknownFields

-- | Encode types with a single constructor as sums, so that
--   allNullaryToStringTag and sumEncoding apply.
data TagSingleConstructors

-- | the encoding will always follow the <a>sumEncoding</a>.
data NoAllNullaryToStringTag

-- | Unpack single-field records
data UnwrapUnaryRecords

-- | <pre>
--   { "tag": t, "content": c}
--   </pre>
data SumTaggedObject (t :: k) (c :: k1)

-- | <pre>
--   CONTENT
--   </pre>
data SumUntaggedValue

-- | <pre>
--   { TAG: CONTENT }
--   </pre>
data SumObjectWithSingleField

-- | <pre>
--   [TAG, CONTENT]
--   </pre>
data SumTwoElemArray

-- | Strip prefix <tt>t</tt>. If it doesn't have the prefix, keep it as-is.
data StripPrefix (t :: k)

-- | Strip suffix <tt>t</tt>. If it doesn't have the suffix, keep it as-is.
data StripSuffix (t :: k)

-- | Generic CamelTo constructor taking in a separator char
data CamelTo (separator :: Symbol)

-- | CamelCase to kebab-case
type CamelToKebab = CamelTo "-"

-- | CamelCase to snake_case
type CamelToSnake = CamelTo "_"

-- | Rename fields called <tt>from</tt> to <tt>to</tt>.
data Rename (from :: Symbol) (to :: Symbol)

-- | Reify <a>Options</a> from a type-level list
class AesonOptions (xs :: k)
aesonOptions :: AesonOptions xs => Options

-- | Reify a function which modifies names
class StringModifier (t :: k)
getStringModifier :: StringModifier t => String -> String
class FromJSON a
class ToJSON a
class Generic a
instance Deriving.Aeson.AesonOptions xs => Deriving.Aeson.AesonOptions (Deriving.Aeson.UnwrapUnaryRecords : xs)
instance Deriving.Aeson.AesonOptions xs => Deriving.Aeson.AesonOptions (Deriving.Aeson.OmitNothingFields : xs)
instance Deriving.Aeson.AesonOptions xs => Deriving.Aeson.AesonOptions (Deriving.Aeson.RejectUnknownFields : xs)
instance forall k (f :: k) (xs :: [*]). (Deriving.Aeson.StringModifier f, Deriving.Aeson.AesonOptions xs) => Deriving.Aeson.AesonOptions (Deriving.Aeson.FieldLabelModifier f : xs)
instance forall k (f :: k) (xs :: [*]). (Deriving.Aeson.StringModifier f, Deriving.Aeson.AesonOptions xs) => Deriving.Aeson.AesonOptions (Deriving.Aeson.ConstructorTagModifier f : xs)
instance Deriving.Aeson.AesonOptions xs => Deriving.Aeson.AesonOptions (Deriving.Aeson.TagSingleConstructors : xs)
instance Deriving.Aeson.AesonOptions xs => Deriving.Aeson.AesonOptions (Deriving.Aeson.NoAllNullaryToStringTag : xs)
instance (GHC.Internal.TypeLits.KnownSymbol t, GHC.Internal.TypeLits.KnownSymbol c, Deriving.Aeson.AesonOptions xs) => Deriving.Aeson.AesonOptions (Deriving.Aeson.SumTaggedObject t c : xs)
instance Deriving.Aeson.AesonOptions xs => Deriving.Aeson.AesonOptions (Deriving.Aeson.SumUntaggedValue : xs)
instance Deriving.Aeson.AesonOptions xs => Deriving.Aeson.AesonOptions (Deriving.Aeson.SumObjectWithSingleField : xs)
instance Deriving.Aeson.AesonOptions xs => Deriving.Aeson.AesonOptions (Deriving.Aeson.SumTwoElemArray : xs)
instance Deriving.Aeson.AesonOptions '[]
instance forall k (t :: k) a. (Deriving.Aeson.AesonOptions t, GHC.Internal.Generics.Generic a, Data.Aeson.Types.FromJSON.GFromJSON Data.Aeson.Types.Generic.Zero (GHC.Internal.Generics.Rep a)) => Data.Aeson.Types.FromJSON.FromJSON (Deriving.Aeson.CustomJSON t a)
instance forall a1 (a2 :: a1) (as :: [a1]). (Deriving.Aeson.StringModifier a2, Deriving.Aeson.StringModifier as) => Deriving.Aeson.StringModifier (a2 : as)
instance Deriving.Aeson.StringModifier '[]
instance (GHC.Internal.TypeLits.KnownSymbol separator, Deriving.Aeson.NonEmptyString separator) => Deriving.Aeson.StringModifier (Deriving.Aeson.CamelTo separator)
instance (GHC.Internal.TypeLits.KnownSymbol from, GHC.Internal.TypeLits.KnownSymbol to) => Deriving.Aeson.StringModifier (Deriving.Aeson.Rename from to)
instance GHC.Internal.TypeLits.KnownSymbol k => Deriving.Aeson.StringModifier (Deriving.Aeson.StripPrefix k)
instance GHC.Internal.TypeLits.KnownSymbol k => Deriving.Aeson.StringModifier (Deriving.Aeson.StripSuffix k)
instance (Deriving.Aeson.StringModifier a, Deriving.Aeson.StringModifier b) => Deriving.Aeson.StringModifier (a, b)
instance (Deriving.Aeson.StringModifier a, Deriving.Aeson.StringModifier b, Deriving.Aeson.StringModifier c) => Deriving.Aeson.StringModifier (a, b, c)
instance (Deriving.Aeson.StringModifier a, Deriving.Aeson.StringModifier b, Deriving.Aeson.StringModifier c, Deriving.Aeson.StringModifier d) => Deriving.Aeson.StringModifier (a, b, c, d)
instance forall k (t :: k) a. (Deriving.Aeson.AesonOptions t, GHC.Internal.Generics.Generic a, Data.Aeson.Types.Class.GToJSON Data.Aeson.Types.Generic.Zero (GHC.Internal.Generics.Rep a), Data.Aeson.Types.Class.GToEncoding Data.Aeson.Types.Generic.Zero (GHC.Internal.Generics.Rep a)) => Data.Aeson.Types.ToJSON.ToJSON (Deriving.Aeson.CustomJSON t a)

module Deriving.Aeson.Stock

-- | Field names are prefixed by <tt>str</tt>; strip them from JSON
--   representation
type Prefixed (str :: k) = CustomJSON '[FieldLabelModifier StripPrefix str]

-- | Strip <tt>str</tt> prefices and convert from CamelCase to snake_case
type PrefixedSnake (str :: k) = CustomJSON '[FieldLabelModifier '[StripPrefix str, CamelToSnake]]

-- | Field names are suffixed by <tt>str</tt>; strip them from JSON
--   representation
type Suffixed (str :: k) = CustomJSON '[FieldLabelModifier StripSuffix str]

-- | Strip <tt>str</tt> suffixes and convert from CamelCase to snake_case
type SuffixedSnake (str :: k) = CustomJSON '[FieldLabelModifier '[StripSuffix str, CamelToSnake]]

-- | Convert from CamelCase to snake_case
type Snake = CustomJSON '[FieldLabelModifier CamelToSnake]

-- | No customisation
type Vanilla = CustomJSON '[] :: [Type]

-- | A newtype wrapper which gives FromJSON/ToJSON instances with modified
--   options.
newtype CustomJSON (t :: k) a
CustomJSON :: a -> CustomJSON (t :: k) a
[unCustomJSON] :: CustomJSON (t :: k) a -> a
class FromJSON a
class ToJSON a
class Generic a
