-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Utilities for working with Aeson.
--
@package aeson-utils
@version 0.3
-- | This module provides a few small functions to make working with aeson
-- easier. Hopefully at some point they won't be needed anymore.
module Data.Aeson.Utils
-- | Deserialize any JSON value. Allows atomic values on the top level
decodeV :: FromJSON a => ByteString -> Maybe a
-- | Like decodeV, but returns an error message when decoding fails.
eitherDecodeV :: FromJSON a => ByteString -> Either String a
-- | Convert a RealFloat (like a Double or Float) into
-- a Scientific number.
--
-- Note that this function uses floatToDigits to compute the
-- digits and exponent of the RealFloat number. Be aware that the
-- algorithm used in floatToDigits doesn't work as expected for
-- some numbers, e.g. as the Double 1e23 is converted to
-- 9.9999999999999991611392e22, and that value is shown as
-- 9.999999999999999e22 rather than the shorter 1e23;
-- the algorithm doesn't take the rounding direction for values exactly
-- half-way between two adjacent representable values into account, so if
-- you have a value with a short decimal representation exactly half-way
-- between two adjacent representable values, like 5^23*2^e for
-- e close to 23, the algorithm doesn't know in which direction
-- the short decimal representation would be rounded and computes more
-- digits
fromFloatDigits :: RealFloat a => a -> Scientific
-- | Optionally create a Pair.
(.=?) :: ToJSON a => Text -> Maybe a -> Maybe Pair
-- | Convert a Scientific into an Integer if it doesn't have decimal
-- points, otherwise to a Double.
-- | Deprecated: Use Data.Scientific.floatingOrInteger instead
parseNumber :: Scientific -> Either Integer Double
-- | floatingOrInteger determines if the scientific is floating
-- point or integer. In case it's floating-point the scientific is
-- converted to the desired RealFloat using toRealFloat.
--
-- Also see: isFloating or isInteger.
floatingOrInteger :: (RealFloat r, Integral i) => Scientific -> Either r i