Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- shouldRunInSim :: (forall s. IOSim s a) -> IO a
- printTrace :: forall log a. (Typeable log, ToJSON log) => Proxy log -> SimTrace a -> Text
- shouldBe :: (HasCallStack, MonadThrow m, Eq a, Show a) => a -> a -> m ()
- shouldReturn :: (HasCallStack, MonadThrow m, Eq a, Show a) => m a -> a -> m ()
- shouldSatisfy :: (HasCallStack, MonadThrow m, Show a) => a -> (a -> Bool) -> m ()
- shouldNotBe :: (HasCallStack, MonadThrow m, Eq a, Show a) => a -> a -> m ()
- shouldContain :: (HasCallStack, MonadThrow m, Eq a, Show a) => [a] -> [a] -> m ()
- traceInIOSim :: Typeable a => Tracer (IOSim s) a
- traceDebug :: (Applicative m, ToJSON a) => Tracer m a
- propCollisionResistant :: (Show a, Eq a) => String -> Gen a -> Spec
- isContinuous :: (Eq a, Enum a) => [a] -> Bool
- isMonotonic :: Ord a => [a] -> Bool
- isStrictlyMonotonic :: Ord a => [a] -> Bool
Documentation
shouldRunInSim :: (forall s. IOSim s a) -> IO a Source #
Run given action
in IOSim
and rethrow any exceptions.
printTrace :: forall log a. (Typeable log, ToJSON log) => Proxy log -> SimTrace a -> Text Source #
Utility function to dump logs given a SimTrace
.
shouldBe :: (HasCallStack, MonadThrow m, Eq a, Show a) => a -> a -> m () Source #
Lifted variant of Hspec's shouldBe
.
shouldReturn :: (HasCallStack, MonadThrow m, Eq a, Show a) => m a -> a -> m () Source #
Lifted variant of Hspec's shouldReturn
.
shouldSatisfy :: (HasCallStack, MonadThrow m, Show a) => a -> (a -> Bool) -> m () Source #
Lifted variant of Hspec's shouldSatisfy
.
shouldNotBe :: (HasCallStack, MonadThrow m, Eq a, Show a) => a -> a -> m () Source #
Lifted variant of Hspec's shouldNotBe
.
shouldContain :: (HasCallStack, MonadThrow m, Eq a, Show a) => [a] -> [a] -> m () Source #
Lifted variant of Hspec's shouldContain
.
traceInIOSim :: Typeable a => Tracer (IOSim s) a Source #
A Tracer
that works in IOSim
monad.
This tracer uses the Output
event which uses converts value traced to Dynamic
which requires Typeable
constraint. To retrieve the trace use selectTraceEventsDynamic
applied to the correct type.
traceDebug :: (Applicative m, ToJSON a) => Tracer m a Source #
Useful when one needs to also trace logs to stderr
.
Thanks to the monoidal nature of Tracer
it's straightforward to add this to
any existing tracer:
@
someCode tracer = do
foo <- makeFoo
withTracer (tr <> traceDebug) SomeTraceFoo
...
@
propCollisionResistant :: (Show a, Eq a) => String -> Gen a -> Spec Source #
This creates an hspec test case about a property which ensures the given generator does not produce equals values within a reasonable number of generated values.
isContinuous :: (Eq a, Enum a) => [a] -> Bool Source #
Predicate which decides whether given list is continuous.
isMonotonic :: Ord a => [a] -> Bool Source #
Predicate which decides whether given list is monotonic.
isStrictlyMonotonic :: Ord a => [a] -> Bool Source #
Predicate which decides whether given list is strictly monotonic.