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


-- | The cardano full node
@package hedgehog-extras
@version 0.1.0.0

module Hedgehog.Extras.Internal.Cli

-- | Format argument for a shell CLI command.
--   
--   This includes automatically embedding string in double quotes if
--   necessary, including any necessary escaping.
--   
--   Note, this function does not cover all the edge cases for shell
--   processing, so avoid use in production code.
argQuote :: String -> String

module Hedgehog.Extras.Internal.Plan
newtype Plan
Plan :: [Component] -> Plan
[installPlan] :: Plan -> [Component]
data Component
Component :: Maybe Text -> Maybe Text -> Component
[componentName] :: Component -> Maybe Text
[binFile] :: Component -> Maybe Text
instance GHC.Show.Show Hedgehog.Extras.Internal.Plan.Component
instance GHC.Classes.Eq Hedgehog.Extras.Internal.Plan.Component
instance GHC.Generics.Generic Hedgehog.Extras.Internal.Plan.Component
instance GHC.Show.Show Hedgehog.Extras.Internal.Plan.Plan
instance GHC.Classes.Eq Hedgehog.Extras.Internal.Plan.Plan
instance GHC.Generics.Generic Hedgehog.Extras.Internal.Plan.Plan
instance Data.Aeson.Types.FromJSON.FromJSON Hedgehog.Extras.Internal.Plan.Plan
instance Data.Aeson.Types.FromJSON.FromJSON Hedgehog.Extras.Internal.Plan.Component

module Hedgehog.Extras.Internal.Test.Integration
type Integration a = PropertyT (ReaderT IntegrationState (ResourceT IO)) a
newtype IntegrationState
IntegrationState :: TVar [Integration ()] -> IntegrationState
[integrationStateFinals] :: IntegrationState -> TVar [Integration ()]
newIntegrationStateIO :: IO IntegrationState
newIntegrationStateM :: MonadIO m => m IntegrationState
runIntegrationReaderT :: MonadIO m => ReaderT IntegrationState m a -> m a

module Hedgehog.Extras.Stock.Aeson

-- | Rewrite a JSON object to another JSON object using the function
--   <tt>f</tt>.
--   
--   All other JSON values are preserved.
rewriteObject :: (HashMap Text Value -> HashMap Text Value) -> Value -> Value

module Hedgehog.Extras.Stock.CallStack

-- | Get the module name of the caller.
callerModuleName :: HasCallStack => String

module Hedgehog.Extras.Stock.IO.File

-- | Determine if the given string is found in the given file.
fileContains :: String -> FilePath -> IO Bool

module Hedgehog.Extras.Stock.IO.Network.NamedPipe
doesNamedPipeExist :: FilePath -> IO Bool

module Hedgehog.Extras.Stock.IO.Network.Socket
doesSocketExist :: FilePath -> IO Bool

-- | Check if a TCP port is open
isPortOpen :: Int -> IO Bool

-- | Check if it is possible to connect to a socket address
canConnect :: SockAddr -> IO ()

-- | Open a socket at the specified port for listening
listenOn :: Int -> IO Socket

-- | Allocate the specified number of random ports
allocateRandomPorts :: Int -> IO [Int]

module Hedgehog.Extras.Stock.IO.Process
maybeWaitForProcess :: ProcessHandle -> IO (Maybe ExitCode)
waitSecondsForProcess :: Int -> ProcessHandle -> IO (Either TimedOut (Maybe ExitCode))
data TimedOut
TimedOut :: TimedOut
instance GHC.Show.Show Hedgehog.Extras.Stock.IO.Process.TimedOut
instance GHC.Classes.Eq Hedgehog.Extras.Stock.IO.Process.TimedOut

module Hedgehog.Extras.Stock.Monad

-- | Force the evaluation of the return value in a monadic computation.
forceM :: (Monad m, NFData a) => m a -> m a

module Hedgehog.Extras.Stock.OS

-- | Determine if the operating system is Windows.
isWin32 :: Bool

module Hedgehog.Extras.Stock.IO.Network.Sprocket

-- | Socket emulation. On Posix it represents a socket. On Windows it
--   represents a named pipe.
data Sprocket
Sprocket :: String -> String -> Sprocket
[sprocketBase] :: Sprocket -> String
[sprocketName] :: Sprocket -> String

-- | Test if the sprocket exists
doesSprocketExist :: Sprocket -> IO Bool

-- | Use this when needing to pass a sprocket into a command line argument.
sprocketArgumentName :: Sprocket -> FilePath

-- | Use this to query the OS about the sprocket
sprocketSystemName :: Sprocket -> FilePath
maxSprocketArgumentNameLength :: Int
instance GHC.Show.Show Hedgehog.Extras.Stock.IO.Network.Sprocket.Sprocket
instance GHC.Classes.Eq Hedgehog.Extras.Stock.IO.Network.Sprocket.Sprocket

module Hedgehog.Extras.Stock.String

-- | Strip whitepsace from the beginning and end of the string.
strip :: String -> String

-- | Get the last line in the string
lastLine :: String -> String

-- | Get the first line in the string
firstLine :: String -> String

module Hedgehog.Extras.Stock.Time

-- | Show <a>UTCTime</a> in seconds since epoch
showUTCTimeSeconds :: UTCTime -> String

-- | Format the given time as an ISO 8601 date-time string
formatIso8601 :: UTCTime -> String

module Hedgehog.Extras.Test.Concurrent
threadDelay :: (MonadTest m, MonadIO m) => Int -> m ()

module Hedgehog.Extras.Test.MonadAssertion
class Monad m => MonadAssertion m
throwAssertion :: MonadAssertion m => Failure -> m a
catchAssertion :: MonadAssertion m => m a -> (Failure -> m a) -> m a
instance GHC.Base.Monad m => Hedgehog.Extras.Test.MonadAssertion.MonadAssertion (Hedgehog.Internal.Property.PropertyT m)
instance GHC.Base.Monad m => Hedgehog.Extras.Test.MonadAssertion.MonadAssertion (Hedgehog.Internal.Property.TestT m)
instance Hedgehog.Extras.Test.MonadAssertion.MonadAssertion m => Hedgehog.Extras.Test.MonadAssertion.MonadAssertion (Control.Monad.Trans.Resource.Internal.ResourceT m)

module Hedgehog.Extras.Test.Base

-- | Run a property with only one test. This is intended for allowing
--   hedgehog to run unit tests.
propertyOnce :: HasCallStack => Integration () -> Property

-- | Create a workspace directory which will exist for at least the
--   duration of the supplied block.
--   
--   The directory will have the supplied prefix but contain a generated
--   random suffix to prevent interference between tests
--   
--   The directory will be deleted if the block succeeds, but left behind
--   if the block fails.
workspace :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> (FilePath -> m ()) -> m ()

-- | Create a workspace directory which will exist for at least the
--   duration of the supplied block.
--   
--   The directory will have the prefix as "$prefixPath/$moduleName" but
--   contain a generated random suffix to prevent interference between
--   tests
--   
--   The directory will be deleted if the block succeeds, but left behind
--   if the block fails.
moduleWorkspace :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> (FilePath -> m ()) -> m ()

-- | Annotate with the given string.
note :: (MonadTest m, HasCallStack) => String -> m String

-- | Annotate the given string returning unit.
note_ :: (MonadTest m, HasCallStack) => String -> m ()

-- | Annotate the given string in a monadic context.
noteM :: (MonadTest m, MonadCatch m, HasCallStack) => m String -> m String

-- | Annotate the given string in a monadic context returning unit.
noteM_ :: (MonadTest m, MonadCatch m, HasCallStack) => m String -> m ()

-- | Annotate the given string in IO.
noteIO :: (MonadTest m, MonadIO m, HasCallStack) => IO String -> m String

-- | Annotate the given string in IO returning unit.
noteIO_ :: (MonadTest m, MonadIO m, HasCallStack) => IO String -> m ()

-- | Annotate the given value.
noteShow :: (MonadTest m, HasCallStack, Show a) => a -> m a

-- | Annotate the given value returning unit.
noteShow_ :: (MonadTest m, HasCallStack, Show a) => a -> m ()

-- | Annotate the given value in a monadic context.
noteShowM :: (MonadTest m, MonadCatch m, HasCallStack, Show a) => m a -> m a

-- | Annotate the given value in a monadic context returning unit.
noteShowM_ :: (MonadTest m, MonadCatch m, HasCallStack, Show a) => m a -> m ()

-- | Annotate the given value in IO.
noteShowIO :: (MonadTest m, MonadIO m, HasCallStack, Show a) => IO a -> m a

-- | Annotate the given value in IO returning unit.
noteShowIO_ :: (MonadTest m, MonadIO m, HasCallStack, Show a) => IO a -> m ()

-- | Annotate the each value in the given traversable.
noteEach :: (MonadTest m, HasCallStack, Show a, Traversable f) => f a -> m (f a)

-- | Annotate the each value in the given traversable returning unit.
noteEach_ :: (MonadTest m, HasCallStack, Show a, Traversable f) => f a -> m ()

-- | Annotate the each value in the given traversable in a monadic context.
noteEachM :: (MonadTest m, HasCallStack, Show a, Traversable f) => m (f a) -> m (f a)

-- | Annotate the each value in the given traversable in a monadic context
--   returning unit.
noteEachM_ :: (MonadTest m, HasCallStack, Show a, Traversable f) => m (f a) -> m ()

-- | Annotate the each value in the given traversable in IO.
noteEachIO :: (MonadTest m, MonadIO m, HasCallStack, Show a, Traversable f) => IO (f a) -> m (f a)

-- | Annotate the each value in the given traversable in IO returning unit.
noteEachIO_ :: (MonadTest m, MonadIO m, HasCallStack, Show a, Traversable f) => IO (f a) -> m ()

-- | Return the test file path after annotating it relative to the project
--   root directory
noteTempFile :: (MonadTest m, HasCallStack) => FilePath -> FilePath -> m FilePath

-- | Takes a <a>CallStack</a> so the error can be rendered at the
--   appropriate call site.
failWithCustom :: MonadTest m => CallStack -> Maybe Diff -> String -> m a

-- | Takes a <a>CallStack</a> so the error can be rendered at the
--   appropriate call site.
failMessage :: MonadTest m => CallStack -> String -> m a

-- | Run the operation <tt>f</tt> once a second until it returns
--   <a>True</a> or the deadline expires.
--   
--   Expiration of the deadline results in an assertion failure
assertByDeadlineM :: (MonadTest m, MonadIO m, HasCallStack) => UTCTime -> m Bool -> m ()

-- | Run the operation <tt>f</tt> once a second until it returns
--   <a>True</a> or the deadline expires.
--   
--   Expiration of the deadline results in an assertion failure
assertByDeadlineIO :: (MonadTest m, MonadIO m, HasCallStack) => UTCTime -> IO Bool -> m ()

-- | Run the operation <tt>f</tt> once a second until it returns
--   <a>True</a> or the deadline expires.
--   
--   The action <tt>g</tt> is run after expiration of the deadline, but
--   before failure allowing for additional annotations to be presented.
--   
--   Expiration of the deadline results in an assertion failure
assertByDeadlineMFinally :: (MonadTest m, MonadIO m, HasCallStack) => UTCTime -> m Bool -> m () -> m ()

-- | Run the operation <tt>f</tt> once a second until it returns
--   <a>True</a> or the deadline expires.
--   
--   The action <tt>g</tt> is run after expiration of the deadline, but
--   before failure allowing for additional annotations to be presented.
--   
--   Expiration of the deadline results in an assertion failure
assertByDeadlineIOFinally :: (MonadTest m, MonadIO m, HasCallStack) => UTCTime -> IO Bool -> m () -> m ()

-- | Run the monadic action <tt>f</tt> and assert the return value is
--   <a>True</a>.
assertM :: (MonadTest m, HasCallStack) => m Bool -> m ()

-- | Run the IO action <tt>f</tt> and assert the return value is
--   <a>True</a>.
assertIO :: (MonadTest m, MonadIO m, HasCallStack) => IO Bool -> m ()
onFailure :: Integration () -> Integration ()
type Integration a = PropertyT (ReaderT IntegrationState (ResourceT IO)) a

-- | Release the given release key.
release :: (MonadTest m, MonadIO m) => ReleaseKey -> m ()
runFinallies :: Integration a -> Integration a

module Hedgehog.Extras.Test.File

-- | Create the <tt>filePath</tt> directory if it is missing.
createDirectoryIfMissing :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> m ()

-- | Copy the contents of the <tt>src</tt> file to the <tt>dst</tt> file.
copyFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> FilePath -> m ()

-- | Rename the <tt>src</tt> file to <tt>dst</tt>.
renameFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> FilePath -> m ()

-- | Create a symbolic link from <tt>dst</tt> to <tt>src</tt>.
createFileLink :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> FilePath -> m ()

-- | List <tt>p</tt> directory.
listDirectory :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> m [FilePath]

-- | Write <tt>contents</tt> to the <tt>filePath</tt> file.
writeFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> String -> m ()

-- | Open a handle to the <tt>filePath</tt> file.
openFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> IOMode -> m Handle

-- | Read the contents of the <tt>filePath</tt> file.
readFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> m String

-- | Write <tt>contents</tt> to the <tt>filePath</tt> file.
lbsWriteFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> ByteString -> m ()

-- | Read the contents of the <tt>filePath</tt> file.
lbsReadFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> m ByteString

-- | Write <tt>contents</tt> to the <tt>filePath</tt> file.
textWriteFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> Text -> m ()

-- | Read the contents of the <tt>filePath</tt> file.
textReadFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> m Text

-- | Read the <tt>filePath</tt> file as JSON.
readJsonFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> m (Either String Value)

-- | Rewrite the <tt>filePath</tt> JSON file using the function <tt>f</tt>.
rewriteJson :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> (Value -> Value) -> m ()

-- | Annotate the contents of the <tt>filePath</tt> file.
cat :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> m ()

-- | Assert the <tt>filePath</tt> can be parsed as JSON.
assertIsJsonFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> m ()

-- | Checks if all files gives exists. If this fails, all files are
--   deleted.
assertFilesExist :: (MonadTest m, MonadIO m, HasCallStack) => [FilePath] -> m ()

-- | Assert the file contains the given number of occurrences of the given
--   string
assertFileOccurences :: (MonadTest m, MonadIO m, HasCallStack) => Int -> String -> FilePath -> m ()

-- | Assert the file contains the given number of occurrences of the given
--   string
assertFileLines :: (MonadTest m, MonadIO m, HasCallStack) => (Int -> Bool) -> FilePath -> m ()

-- | Assert the file contains the given number of occurrences of the given
--   string
assertEndsWithSingleNewline :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> m ()

module Hedgehog.Extras.Test.Network

-- | Test if a file exists
doesFileExists :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> m Bool

-- | Test if a port is open
isPortOpen :: (MonadTest m, MonadIO m, HasCallStack) => Int -> m Bool

-- | Test if a socket file exists
doesSocketExist :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> m Bool

-- | Assert that a file exists
assertFileExists :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> m ()

-- | Assert that a port is open
assertPortOpen :: (MonadTest m, MonadIO m, HasCallStack) => Int -> m ()

-- | Assert that a socket file exists is open
assertSocketExists :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> m ()

-- | Test if the sprocket exists
doesSprocketExist :: (MonadTest m, MonadIO m, HasCallStack) => Sprocket -> m Bool

module Hedgehog.Extras.Test.Process

-- | Create a process returning handles to stdin, stdout, and stderr as
--   well as the process handle.
createProcess :: (MonadTest m, MonadResource m, HasCallStack) => CreateProcess -> m (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle, ReleaseKey)

-- | Create a process returning its stdout.
--   
--   Being a <tt>flex</tt> function means that the environment determines
--   how the process is launched.
--   
--   When running in a nix environment, the <tt>envBin</tt> argument
--   describes the environment variable that defines the binary to use to
--   launch the process.
--   
--   When running outside a nix environment, the <tt>pkgBin</tt> describes
--   the name of the binary to launch via cabal exec.
execFlex :: (MonadTest m, MonadCatch m, MonadIO m, HasCallStack) => String -> String -> [String] -> m String

-- | Create a <a>CreateProcess</a> describing how to start a process given
--   the Cabal package name corresponding to the executable, an environment
--   variable pointing to the executable, and an argument list.
--   
--   The actual executable used will the one specified by the environment
--   variable, but if the environment variable is not defined, it will be
--   found instead by consulting the "plan.json" generated by cabal. It is
--   assumed that the project has already been configured and the
--   executable has been built.
procFlex :: (MonadTest m, MonadCatch m, MonadIO m, HasCallStack) => String -> String -> [String] -> m CreateProcess

-- | Compute the project base. This will be based on either the
--   <a>CARDANO_NODE_SRC</a> environment variable or the parent directory.
--   Both should point to the root directory of the Github project
--   checkout.
getProjectBase :: (MonadTest m, MonadIO m) => m String

-- | Wait for process to exit.
waitForProcess :: (MonadTest m, MonadIO m, HasCallStack) => ProcessHandle -> m ExitCode

-- | Wait for process to exit or return <a>Nothing</a> if interrupted by an
--   asynchronous exception.
maybeWaitForProcess :: (MonadTest m, MonadIO m, HasCallStack) => ProcessHandle -> m (Maybe ExitCode)

-- | Get the process ID.
getPid :: (MonadTest m, MonadIO m, HasCallStack) => ProcessHandle -> m (Maybe Pid)

-- | Wait a maximum of <tt>seconds</tt> secons for process to exit.
waitSecondsForProcess :: (MonadTest m, MonadIO m, HasCallStack) => Int -> ProcessHandle -> m (Either TimedOut ExitCode)
