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


-- | Use tests to monitor changes in Aeson serialization
--   
--   Use tests to monitor changes in Aeson serialization
@package hspec-golden-aeson
@version 0.2.0.3


module Test.Aeson.Internal.Utils
data Settings
Settings :: GoldenDirectoryOption -> Bool -> Int -> Settings

-- | use a custom directory name or use the generic "golden" directory.
[goldenDirectoryOption] :: Settings -> GoldenDirectoryOption

-- | If true, use the module name in the file path, otherwise ignore it.
[useModuleNameAsSubDirectory] :: Settings -> Bool

-- | How many instances of each type you want. If you use ADT versions than
--   it will use the sample size for each constructor.
[sampleSize] :: Settings -> Int

-- | A custom directory name or a preselected directory name.
data GoldenDirectoryOption
CustomDirectoryName :: String -> GoldenDirectoryOption
GoldenDirectory :: GoldenDirectoryOption

-- | The default settings for general use cases.
defaultSettings :: Settings

-- | put brackets around a String.
addBrackets :: String -> String

-- | <a>hspec</a> style combinator to easily write tests that check the a
--   given operation returns the same value it was given, e.g. roundtrip
--   tests.
shouldBeIdentity :: (Eq a, Show a, Arbitrary a) => Proxy a -> (a -> IO a) -> Property

-- | run decode in IO, if it returns Left then throw an error.
aesonDecodeIO :: FromJSON a => ByteString -> IO a


-- | Internal module, use at your own risk.
module Test.Aeson.Internal.RoundtripSpecs

-- | A roundtrip test to check whether values of the given type can be
--   successfully converted to JSON and back to a Haskell value.
--   
--   <a>roundtripSpecs</a> will
--   
--   <ul>
--   <li>create random values (using <a>Arbitrary</a>),</li>
--   <li>convert them into JSON (using <a>ToJSON</a>),</li>
--   <li>read them back into Haskell (using <a>FromJSON</a>) and</li>
--   <li>make sure that the result is the same as the value it started with
--   (using <a>Eq</a>).</li>
--   </ul>
roundtripSpecs :: forall a. (Typeable a, Eq a, Show a, Arbitrary a, ToJSON a, FromJSON a) => Proxy a -> Spec

-- | Same as <a>roundtripSpecs</a>, but optionally add notes to the
--   <a>describe</a> function.
genericAesonRoundtripWithNote :: forall a. (Typeable a, Eq a, Show a, Arbitrary a, ToJSON a, FromJSON a) => Proxy a -> Maybe String -> Spec


-- | Internal module, use at your own risk.
module Test.Aeson.Internal.RandomSamples

-- | RandomSamples, using a seed allows you to replicate an arbitrary. By
--   storing the seed and the samples (previously produced arbitraries), we
--   can try to reproduce the same samples by generating the arbitraries
--   with a seed.
data RandomSamples a
RandomSamples :: Int -> [a] -> RandomSamples a
[seed] :: RandomSamples a -> Int
[samples] :: RandomSamples a -> [a]

-- | Apply the seed.
setSeed :: Int -> Gen a -> Gen a

-- | Reads the seed without looking at the samples.
readSeed :: ByteString -> IO Int

-- | Read the sample size.
readSampleSize :: ByteString -> IO Int
instance GHC.Generics.Generic (Test.Aeson.Internal.RandomSamples.RandomSamples a)
instance GHC.Show.Show a => GHC.Show.Show (Test.Aeson.Internal.RandomSamples.RandomSamples a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Test.Aeson.Internal.RandomSamples.RandomSamples a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Test.Aeson.Internal.RandomSamples.RandomSamples a)
instance Data.Aeson.Types.FromJSON.FromJSON a => Data.Aeson.Types.FromJSON.FromJSON (Test.Aeson.Internal.RandomSamples.RandomSamples a)
instance Data.Aeson.Types.ToJSON.ToJSON a => Data.Aeson.Types.ToJSON.ToJSON (Test.Aeson.Internal.RandomSamples.RandomSamples a)


-- | Internal module, use at your own risk.
module Test.Aeson.Internal.GoldenSpecs

-- | Tests to ensure that JSON encoding has not unintentionally changed.
--   This could be caused by the following:
--   
--   <ul>
--   <li>A type's instances of <a>ToJSON</a> or <a>FromJSON</a> have
--   changed.</li>
--   <li>Selectors have been edited, added or deleted.</li>
--   <li>You have changed version of Aeson the way Aeson serialization has
--   changed works.</li>
--   </ul>
--   
--   If you run this function and the golden files do not exist, it will
--   create them for each constructor. It they do exist, it will compare
--   with golden file if it exists. Golden file encodes json format of a
--   type. It is recommended that you put the golden files under revision
--   control to help monitor changes.
goldenSpecs :: (Eq a, Show a, Typeable a, Arbitrary a, ToJSON a, FromJSON a) => Settings -> Proxy a -> Spec

-- | same as <a>goldenSpecs</a> but has the option of passing a note to the
--   <a>describe</a> function.
goldenSpecsWithNote :: forall a. (Eq a, Show a, Typeable a, Arbitrary a, ToJSON a, FromJSON a) => Settings -> Proxy a -> Maybe String -> Spec

-- | The golden files already exist. Serialize values with the same seed
--   from the golden file and compare the with the JSON in the golden file.
compareWithGolden :: forall a. (Eq a, Show a, Typeable a, Arbitrary a, ToJSON a, FromJSON a) => FilePath -> Maybe FilePath -> Proxy a -> FilePath -> IO ()

-- | The golden files do not exist. Create it.
createGoldenfile :: forall a. (Show a, Arbitrary a, ToJSON a) => Settings -> Proxy a -> FilePath -> IO ()

-- | Create the file path for the golden file. Optionally use the module
--   name to help avoid name collissions. Different modules can have types
--   of the same name.
mkGoldenFile :: Typeable a => FilePath -> Maybe FilePath -> Proxy a -> FilePath

-- | Create the file path to save results from a failed golden test.
--   Optionally use the module name to help avoid name collisions.
--   Different modules can have types of the same name.
mkFaultyFile :: Typeable a => FilePath -> Maybe FilePath -> Proxy a -> FilePath

-- | Create a number of arbitrary instances of a type a sample size and a
--   random seed.
mkRandomSamples :: forall a. Arbitrary a => Int -> Proxy a -> Int -> IO (RandomSamples a)


-- | Internal module, use at your own risk.
module Test.Aeson.Internal.ADT.RoundtripSpecs

-- | A roundtrip test to check whether values of all of constructors of the
--   given type can be successfully converted to JSON and back to a Haskell
--   value.
--   
--   <a>roundtripADTSpecs</a> will
--   
--   <ul>
--   <li>create random values for each constructor using
--   <a>ToADTArbitrary</a>,</li>
--   <li>convert them into JSON using <a>ToJSON</a>,</li>
--   <li>read them back into Haskell using <a>FromJSON</a> and</li>
--   <li>make sure that the result is the same as the value it started with
--   using <a>Eq</a>.</li>
--   </ul>
roundtripADTSpecs :: forall a. (ToADTArbitrary a, Eq a, Show a, Arbitrary a, ToJSON a, FromJSON a) => Proxy a -> Spec

-- | Same as <a>roundtripADTSpecs</a> but has the option of passing a note
--   to the <a>describe</a> function.
genericAesonRoundtripADTWithNote :: forall a. (ToADTArbitrary a, Eq a, Show a, Arbitrary a, ToJSON a, FromJSON a) => Proxy a -> Maybe String -> Spec


-- | Internal module, use at your own risk.
module Test.Aeson.Internal.ADT.GoldenSpecs

-- | Tests to ensure that JSON encoding has not unintentionally changed.
--   This could be caused by the following:
--   
--   <ul>
--   <li>A type's instances of <a>ToJSON</a> or <a>FromJSON</a> have
--   changed.</li>
--   <li>Selectors have been edited, added or deleted.</li>
--   <li>You have changed version of Aeson the way Aeson serialization has
--   changed works.</li>
--   </ul>
--   
--   If you run this function and the golden files do not exist, it will
--   create them for each constructor. It they do exist, it will compare
--   with golden file if it exists. Golden file encodes json format of a
--   type. It is recommended that you put the golden files under revision
--   control to help monitor changes.
goldenADTSpecs :: forall a. (ToADTArbitrary a, Eq a, Show a, Arbitrary a, ToJSON a, FromJSON a) => Settings -> Proxy a -> Spec

-- | same as <a>goldenADTSpecs</a> but has the option of passing a note to
--   the <a>describe</a> function.
goldenADTSpecsWithNote :: forall a. (ToADTArbitrary a, Eq a, Show a, Arbitrary a, ToJSON a, FromJSON a) => Settings -> Proxy a -> Maybe String -> Spec

-- | test a single set of values from a constructor for a given type.
testConstructor :: forall a. (Eq a, Show a, FromJSON a, ToJSON a, ToADTArbitrary a) => Settings -> String -> String -> ConstructorArbitraryPair a -> SpecWith (Arg (IO ()))

-- | The golden files already exist. Serialize values with the same seed
--   from the golden files of each constructor and compare.
compareWithGolden :: forall a. (Show a, Eq a, FromJSON a, ToJSON a, ToADTArbitrary a) => String -> Maybe String -> String -> ConstructorArbitraryPair a -> FilePath -> IO ()

-- | The golden files do not exist. Create them for each constructor.
createGoldenFile :: forall a. (ToJSON a, ToADTArbitrary a) => Int -> ConstructorArbitraryPair a -> FilePath -> IO ()

-- | Create the file path for the golden file. Optionally use the module
--   name to help avoid name collissions. Different modules can have types
--   of the same name.
mkGoldenFilePath :: forall a. FilePath -> Maybe FilePath -> FilePath -> ConstructorArbitraryPair a -> FilePath

-- | Create the file path to save results from a failed golden test.
--   Optionally use the module name to help avoid name collisions.
--   Different modules can have types of the same name.
mkFaultyFilePath :: forall a. FilePath -> Maybe FilePath -> FilePath -> ConstructorArbitraryPair a -> FilePath

-- | Create a number of arbitrary instances of a particular constructor
--   given a sample size and a random seed.
mkRandomADTSamplesForConstructor :: forall a. (ToADTArbitrary a) => Int -> Proxy a -> String -> Int -> IO (RandomSamples a)


-- | This package provides tools for testing Aeson serialization.
--   
--   <ul>
--   <li>Test that <a>ToJSON</a> and <a>FromJSON</a> instances are
--   isomorphic.</li>
--   <li>Alert you when unexpected changes in Aeson serialization
--   occur.</li>
--   <li>Record JSON formatting of Haskell types.</li>
--   </ul>
module Test.Aeson.GenericSpecs

-- | Tests to ensure that JSON encoding has not unintentionally changed.
--   This could be caused by the following:
--   
--   <ul>
--   <li>A type's instances of <a>ToJSON</a> or <a>FromJSON</a> have
--   changed.</li>
--   <li>Selectors have been edited, added or deleted.</li>
--   <li>You have changed version of Aeson the way Aeson serialization has
--   changed works.</li>
--   </ul>
--   
--   If you run this function and the golden files do not exist, it will
--   create them for each constructor. It they do exist, it will compare
--   with golden file if it exists. Golden file encodes json format of a
--   type. It is recommended that you put the golden files under revision
--   control to help monitor changes.
goldenSpecs :: (Eq a, Show a, Typeable a, Arbitrary a, ToJSON a, FromJSON a) => Settings -> Proxy a -> Spec

-- | A roundtrip test to check whether values of the given type can be
--   successfully converted to JSON and back to a Haskell value.
--   
--   <a>roundtripSpecs</a> will
--   
--   <ul>
--   <li>create random values (using <a>Arbitrary</a>),</li>
--   <li>convert them into JSON (using <a>ToJSON</a>),</li>
--   <li>read them back into Haskell (using <a>FromJSON</a>) and</li>
--   <li>make sure that the result is the same as the value it started with
--   (using <a>Eq</a>).</li>
--   </ul>
roundtripSpecs :: forall a. (Typeable a, Eq a, Show a, Arbitrary a, ToJSON a, FromJSON a) => Proxy a -> Spec

-- | run roundtrip and golden test for a type. sampleSize is used only when
--   creating the golden file. When it is compared, the sampleSize is
--   derived from the file.
roundtripAndGoldenSpecs :: forall a. (Arbitrary a, Eq a, Show a, ToJSON a, FromJSON a, Typeable a) => Proxy a -> Spec

-- | Tests to ensure that JSON encoding has not unintentionally changed.
--   This could be caused by the following:
--   
--   <ul>
--   <li>A type's instances of <a>ToJSON</a> or <a>FromJSON</a> have
--   changed.</li>
--   <li>Selectors have been edited, added or deleted.</li>
--   <li>You have changed version of Aeson the way Aeson serialization has
--   changed works.</li>
--   </ul>
--   
--   If you run this function and the golden files do not exist, it will
--   create them for each constructor. It they do exist, it will compare
--   with golden file if it exists. Golden file encodes json format of a
--   type. It is recommended that you put the golden files under revision
--   control to help monitor changes.
goldenADTSpecs :: forall a. (ToADTArbitrary a, Eq a, Show a, Arbitrary a, ToJSON a, FromJSON a) => Settings -> Proxy a -> Spec

-- | A roundtrip test to check whether values of all of constructors of the
--   given type can be successfully converted to JSON and back to a Haskell
--   value.
--   
--   <a>roundtripADTSpecs</a> will
--   
--   <ul>
--   <li>create random values for each constructor using
--   <a>ToADTArbitrary</a>,</li>
--   <li>convert them into JSON using <a>ToJSON</a>,</li>
--   <li>read them back into Haskell using <a>FromJSON</a> and</li>
--   <li>make sure that the result is the same as the value it started with
--   using <a>Eq</a>.</li>
--   </ul>
roundtripADTSpecs :: forall a. (ToADTArbitrary a, Eq a, Show a, Arbitrary a, ToJSON a, FromJSON a) => Proxy a -> Spec

-- | run roundtrip and golden tests for all constructors of a type.
--   sampleSize is used only when creating the golden files. When they are
--   compared, the sampleSize is derived from the file.
roundtripAndGoldenADTSpecs :: forall a. (Arbitrary a, ToADTArbitrary a, Eq a, Show a, ToJSON a, FromJSON a) => Proxy a -> Spec

-- | <a>roundtripAndGoldenADTSpecs</a> with custom settings.
roundtripAndGoldenADTSpecsWithSettings :: forall a. (Arbitrary a, ToADTArbitrary a, Eq a, Show a, ToJSON a, FromJSON a) => Settings -> Proxy a -> Spec

-- | <a>hspec</a> style combinator to easily write tests that check the a
--   given operation returns the same value it was given, e.g. roundtrip
--   tests.
shouldBeIdentity :: (Eq a, Show a, Arbitrary a) => Proxy a -> (a -> IO a) -> Property

-- | A custom directory name or a preselected directory name.
data GoldenDirectoryOption
CustomDirectoryName :: String -> GoldenDirectoryOption
GoldenDirectory :: GoldenDirectoryOption
data Settings
Settings :: GoldenDirectoryOption -> Bool -> Int -> Settings

-- | use a custom directory name or use the generic "golden" directory.
[goldenDirectoryOption] :: Settings -> GoldenDirectoryOption

-- | If true, use the module name in the file path, otherwise ignore it.
[useModuleNameAsSubDirectory] :: Settings -> Bool

-- | How many instances of each type you want. If you use ADT versions than
--   it will use the sample size for each constructor.
[sampleSize] :: Settings -> Int

-- | The default settings for general use cases.
defaultSettings :: Settings

-- | A concrete, poly-kinded proxy type
data Proxy k (t :: k) :: forall k. k -> *
Proxy :: Proxy k
