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


-- | Tools to change the formatting of field names in Aeson
--   instances.
--   
--   Tools to change the formatting of field names in Aeson instances. This
--   includes CamelCasing, Pascal Casing and Snake Casing.
@package aeson-casing
@version 0.2.0.0

module Data.Aeson.Casing.Internal

-- | Creates an Aeson options object that drops a specific number of
--   characters from the front of a field name, then applies a casing
--   function.
aesonDrop :: Int -> (String -> String) -> Options

-- | Creates an Aeson options object that drops the field name prefix from
--   a field, then applies a casing function. We assume a convention of the
--   prefix always being lower case, and the first letter of the actual
--   field name being uppercase. This accommodated for field names in GHC
--   7.8 and below.
--   
--   <pre>
--   data Person = Person
--          { personFirstName :: Text
--          , personLastName  :: Text
--          } deriving (Generic)
--   
--   data Dog = Dog
--          { dogFirstName :: Text
--          } deriving (Generic)
--   </pre>
--   
--   In the above cases, dog and person are always dropped from the JSON
--   field names.
aesonPrefix :: (String -> String) -> Options

-- | Snake casing, where the words are always lower case and separated by
--   an underscore.
snakeCase :: String -> String

-- | Train casing, where the words are always lower case and separated by a
--   hyphen
trainCase :: String -> String

-- | Camel casing, where the words are separated by the first letter of
--   each word being a capital. However, the first letter of the field is
--   never a capital.
camelCase :: String -> String

-- | Pascal casing, where the words are separated by the first letter of
--   each word being a capital. The first letter of the field is always a
--   capital.
pascalCase :: String -> String

-- | Generic casing for symbol separated names
symbCase :: Char -> String -> String
applyFirst :: (Char -> Char) -> String -> String
dropFPrefix :: String -> String
dropCPrefix :: String -> String


-- | The casing utilities allow you to specify how Aeson renders and parses
--   the field names in JSON messages. Snake, Camel, and Pascal case are
--   all supported. To include casing modifiers in Aeson, attach options to
--   instances of ToJSON and FromJSON.
--   
--   <pre>
--   data Person = Person
--          { personFirstName :: Text
--          , personLastName  :: Text
--          } deriving (Generic)
--   
--   instance ToJSON Person where
--      toJSON = genericToJSON $ aesonPrefix snakeCase
--   instance FromJSON Person where
--      parseJSON = genericParseJSON $ aesonPrefix snakeCase
--   </pre>
--   
--   The above code will produce JSON messages like the following...
--   
--   <pre>
--   {
--      "first_name": "John",
--      "last_name": "Doe"
--   }
--   </pre>
module Data.Aeson.Casing

-- | Creates an Aeson options object that drops a specific number of
--   characters from the front of a field name, then applies a casing
--   function.
aesonDrop :: Int -> (String -> String) -> Options

-- | Creates an Aeson options object that drops the field name prefix from
--   a field, then applies a casing function. We assume a convention of the
--   prefix always being lower case, and the first letter of the actual
--   field name being uppercase. This accommodated for field names in GHC
--   7.8 and below.
--   
--   <pre>
--   data Person = Person
--          { personFirstName :: Text
--          , personLastName  :: Text
--          } deriving (Generic)
--   
--   data Dog = Dog
--          { dogFirstName :: Text
--          } deriving (Generic)
--   </pre>
--   
--   In the above cases, dog and person are always dropped from the JSON
--   field names.
aesonPrefix :: (String -> String) -> Options

-- | Snake casing, where the words are always lower case and separated by
--   an underscore.
snakeCase :: String -> String

-- | Train casing, where the words are always lower case and separated by a
--   hyphen
trainCase :: String -> String

-- | Camel casing, where the words are separated by the first letter of
--   each word being a capital. However, the first letter of the field is
--   never a capital.
camelCase :: String -> String

-- | Pascal casing, where the words are separated by the first letter of
--   each word being a capital. The first letter of the field is always a
--   capital.
pascalCase :: String -> String
