module Data.Aeson.Decoding.Internal where

import Data.Aeson.Decoding.Tokens

-- | Helper type-class for constructing errors.
class    AsError t        where tkErr :: e -> t k e
instance AsError Tokens   where tkErr :: forall e k. e -> Tokens k e
tkErr = e -> Tokens k e
forall k e. e -> Tokens k e
TkErr
instance AsError TkArray  where tkErr :: forall e k. e -> TkArray k e
tkErr = e -> TkArray k e
forall k e. e -> TkArray k e
TkArrayErr
instance AsError TkRecord where tkErr :: forall e k. e -> TkRecord k e
tkErr = e -> TkRecord k e
forall k e. e -> TkRecord k e
TkRecordErr

negateNumber :: Number -> Number
negateNumber :: Number -> Number
negateNumber (NumInteger Integer
n)    = Integer -> Number
NumInteger (Integer -> Integer
forall a. Num a => a -> a
negate Integer
n)
negateNumber (NumDecimal Scientific
n)    = Scientific -> Number
NumDecimal (Scientific -> Scientific
forall a. Num a => a -> a
negate Scientific
n)
negateNumber (NumScientific Scientific
n) = Scientific -> Number
NumScientific (Scientific -> Scientific
forall a. Num a => a -> a
negate Scientific
n)