Safe Haskell | None |
---|---|
Language | GHC2021 |
Synopsis
- data Assertion (m :: k) a where
- Assert' :: forall {k} (m :: k). AssertionGroup -> AssertionSeverity -> Text -> AssertionStatus -> Assertion m ()
- newtype AssertionGroup = AssertionGroup [Text]
- prettyPrintAssertionGroup :: AssertionGroup -> Text -> Text
- newtype AssertionLog = AssertionLog [AssertionEntry]
- hasFailedAssertions :: AssertionLog -> Bool
- filterFailedAssertions :: AssertionLog -> [Text]
- isFailure :: AssertionEntry -> Bool
- shouldFailNow :: AssertionEntry -> Bool
- data AssertionEntry = AssertionEntry {}
- data AssertionStatus
- pattern FailureWithMessage :: Text -> AssertionStatus
- data AssertionSeverity
- prettyPrintAssertionEntry :: AssertionEntry -> Text
- assert' :: forall (r :: EffectRow). Member (Assertion :: (Type -> Type) -> Type -> Type) r => AssertionGroup -> AssertionSeverity -> Text -> AssertionStatus -> Sem r ()
- successIsTrue :: Bool -> AssertionStatus
- assertTrue :: forall (r :: EffectRow). Member (Assertion :: (Type -> Type) -> Type -> Type) r => Text -> Bool -> Sem r ()
- assertEquals :: forall a (r :: EffectRow). (Eq a, Member (Assertion :: (Type -> Type) -> Type -> Type) r) => Text -> a -> a -> Sem r ()
- assertTrueWith :: forall (r :: EffectRow). Member (Assertion :: (Type -> Type) -> Type -> Type) r => Text -> Bool -> Text -> Sem r ()
- assertTrueWithM :: forall (r :: EffectRow). Member (Assertion :: (Type -> Type) -> Type -> Type) r => Text -> Bool -> Sem r Text -> Sem r ()
- assert :: forall (r :: EffectRow). Member (Assertion :: (Type -> Type) -> Type -> Type) r => Text -> AssertionStatus -> Sem r ()
- assertM :: forall (r :: EffectRow). Member (Assertion :: (Type -> Type) -> Type -> Type) r => Text -> Sem r AssertionStatus -> Sem r ()
- assertError :: forall (r :: EffectRow). Member (Assertion :: (Type -> Type) -> Type -> Type) r => Text -> Sem ((Error Text :: (Type -> Type) -> Type -> Type) ': r) () -> Sem r ()
- failedAssertion :: forall (r :: EffectRow). Member (Assertion :: (Type -> Type) -> Type -> Type) r => Text -> Sem r ()
- failLater :: forall (r :: EffectRow) a. Member (Assertion :: (Type -> Type) -> Type -> Type) r => Sem r a -> Sem r a
- warnOnly :: forall (r :: EffectRow) a. Member (Assertion :: (Type -> Type) -> Type -> Type) r => Sem r a -> Sem r a
- describe :: forall (r :: EffectRow) a. Members '[Assertion :: (Type -> Type) -> Type -> Type, Log :: (Type -> Type) -> Type -> Type] r => Text -> Sem r a -> Sem r a
- describe' :: forall (r :: EffectRow) a. Members '[Assertion :: (Type -> Type) -> Type -> Type, Log :: (Type -> Type) -> Type -> Type] r => [Text] -> Sem r a -> Sem r a
Documentation
data Assertion (m :: k) a where #
Assertion effects so we can skip past them in dry runs, and optionally throw exceptions or just collect them along the way for final reporting, etc..
Assert' :: forall {k} (m :: k). AssertionGroup -> AssertionSeverity -> Text -> AssertionStatus -> Assertion m () | Assertions are run-time checks based on actual results that may be returned by various operations. Dry runs may ignore these failures, but they're respected in real operations. |
Instances
ToDumpItem (b :: k) (Assertion :: (Type -> Type) -> Type -> Type) # | |
Defined in Napkin.Run.Effects.Interceptors.LogProgram | |
GShow (Assertion a :: Type -> Type) # | |
Defined in Napkin.Run.Effects.Languages.Assertion gshowsPrec :: Int -> Assertion a a0 -> ShowS # | |
Show (Assertion a b) # | |
Eq (Assertion a b) # | |
newtype AssertionGroup #
Instances
prettyPrintAssertionGroup :: AssertionGroup -> Text -> Text #
newtype AssertionLog #
Instances
Monoid AssertionLog # | |||||
Defined in Napkin.Run.Effects.Languages.Assertion mempty :: AssertionLog # mappend :: AssertionLog -> AssertionLog -> AssertionLog # mconcat :: [AssertionLog] -> AssertionLog # | |||||
Semigroup AssertionLog # | |||||
Defined in Napkin.Run.Effects.Languages.Assertion (<>) :: AssertionLog -> AssertionLog -> AssertionLog # sconcat :: NonEmpty AssertionLog -> AssertionLog # stimes :: Integral b => b -> AssertionLog -> AssertionLog # | |||||
Generic AssertionLog # | |||||
Defined in Napkin.Run.Effects.Languages.Assertion
from :: AssertionLog -> Rep AssertionLog x # to :: Rep AssertionLog x -> AssertionLog # | |||||
Show AssertionLog # | |||||
Defined in Napkin.Run.Effects.Languages.Assertion showsPrec :: Int -> AssertionLog -> ShowS # show :: AssertionLog -> String # showList :: [AssertionLog] -> ShowS # | |||||
Eq AssertionLog # | |||||
Defined in Napkin.Run.Effects.Languages.Assertion (==) :: AssertionLog -> AssertionLog -> Bool # (/=) :: AssertionLog -> AssertionLog -> Bool # | |||||
type Rep AssertionLog # | |||||
Defined in Napkin.Run.Effects.Languages.Assertion type Rep AssertionLog = D1 ('MetaData "AssertionLog" "Napkin.Run.Effects.Languages.Assertion" "napkin-1.0.0-5YkWAC9Wc776PT0LDghaFb" 'True) (C1 ('MetaCons "AssertionLog" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [AssertionEntry]))) |
hasFailedAssertions :: AssertionLog -> Bool #
filterFailedAssertions :: AssertionLog -> [Text] #
isFailure :: AssertionEntry -> Bool #
shouldFailNow :: AssertionEntry -> Bool #
data AssertionEntry #
AssertionEntry | |
|
Instances
Generic AssertionEntry # | |||||
Defined in Napkin.Run.Effects.Languages.Assertion
from :: AssertionEntry -> Rep AssertionEntry x # to :: Rep AssertionEntry x -> AssertionEntry # | |||||
Show AssertionEntry # | |||||
Defined in Napkin.Run.Effects.Languages.Assertion showsPrec :: Int -> AssertionEntry -> ShowS # show :: AssertionEntry -> String # showList :: [AssertionEntry] -> ShowS # | |||||
Eq AssertionEntry # | |||||
Defined in Napkin.Run.Effects.Languages.Assertion (==) :: AssertionEntry -> AssertionEntry -> Bool # (/=) :: AssertionEntry -> AssertionEntry -> Bool # | |||||
type Rep AssertionEntry # | |||||
Defined in Napkin.Run.Effects.Languages.Assertion type Rep AssertionEntry = D1 ('MetaData "AssertionEntry" "Napkin.Run.Effects.Languages.Assertion" "napkin-1.0.0-5YkWAC9Wc776PT0LDghaFb" 'False) (C1 ('MetaCons "AssertionEntry" 'PrefixI 'True) ((S1 ('MetaSel ('Just "group") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AssertionGroup) :*: S1 ('MetaSel ('Just "message") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :*: (S1 ('MetaSel ('Just "status") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AssertionStatus) :*: S1 ('MetaSel ('Just "severity") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AssertionSeverity)))) |
data AssertionStatus #
Instances
ToJSON AssertionStatus # | |||||
Defined in Napkin.Run.Effects.Languages.Assertion toJSON :: AssertionStatus -> Value # toEncoding :: AssertionStatus -> Encoding # toJSONList :: [AssertionStatus] -> Value # toEncodingList :: [AssertionStatus] -> Encoding # omitField :: AssertionStatus -> Bool # | |||||
Generic AssertionStatus # | |||||
Defined in Napkin.Run.Effects.Languages.Assertion
from :: AssertionStatus -> Rep AssertionStatus x # to :: Rep AssertionStatus x -> AssertionStatus # | |||||
Show AssertionStatus # | |||||
Defined in Napkin.Run.Effects.Languages.Assertion showsPrec :: Int -> AssertionStatus -> ShowS # show :: AssertionStatus -> String # showList :: [AssertionStatus] -> ShowS # | |||||
Eq AssertionStatus # | |||||
Defined in Napkin.Run.Effects.Languages.Assertion (==) :: AssertionStatus -> AssertionStatus -> Bool # (/=) :: AssertionStatus -> AssertionStatus -> Bool # | |||||
type Rep AssertionStatus # | |||||
Defined in Napkin.Run.Effects.Languages.Assertion type Rep AssertionStatus = D1 ('MetaData "AssertionStatus" "Napkin.Run.Effects.Languages.Assertion" "napkin-1.0.0-5YkWAC9Wc776PT0LDghaFb" 'False) (C1 ('MetaCons "Success" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Failure" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)))) |
pattern FailureWithMessage :: Text -> AssertionStatus #
data AssertionSeverity #
Instances
Show AssertionSeverity # | |
Defined in Napkin.Run.Effects.Languages.Assertion showsPrec :: Int -> AssertionSeverity -> ShowS # show :: AssertionSeverity -> String # showList :: [AssertionSeverity] -> ShowS # | |
Eq AssertionSeverity # | |
Defined in Napkin.Run.Effects.Languages.Assertion (==) :: AssertionSeverity -> AssertionSeverity -> Bool # (/=) :: AssertionSeverity -> AssertionSeverity -> Bool # |
assert' :: forall (r :: EffectRow). Member (Assertion :: (Type -> Type) -> Type -> Type) r => AssertionGroup -> AssertionSeverity -> Text -> AssertionStatus -> Sem r () #
Assertions are run-time checks based on actual results that may be returned by various operations. Dry runs may ignore these failures, but they're respected in real operations.
successIsTrue :: Bool -> AssertionStatus #
assertTrue :: forall (r :: EffectRow). Member (Assertion :: (Type -> Type) -> Type -> Type) r => Text -> Bool -> Sem r () #
assertEquals :: forall a (r :: EffectRow). (Eq a, Member (Assertion :: (Type -> Type) -> Type -> Type) r) => Text -> a -> a -> Sem r () #
assertTrueWith :: forall (r :: EffectRow). Member (Assertion :: (Type -> Type) -> Type -> Type) r => Text -> Bool -> Text -> Sem r () #
assertTrueWithM :: forall (r :: EffectRow). Member (Assertion :: (Type -> Type) -> Type -> Type) r => Text -> Bool -> Sem r Text -> Sem r () #
assert :: forall (r :: EffectRow). Member (Assertion :: (Type -> Type) -> Type -> Type) r => Text -> AssertionStatus -> Sem r () #
assertM :: forall (r :: EffectRow). Member (Assertion :: (Type -> Type) -> Type -> Type) r => Text -> Sem r AssertionStatus -> Sem r () #
assertError :: forall (r :: EffectRow). Member (Assertion :: (Type -> Type) -> Type -> Type) r => Text -> Sem ((Error Text :: (Type -> Type) -> Type -> Type) ': r) () -> Sem r () #
failedAssertion :: forall (r :: EffectRow). Member (Assertion :: (Type -> Type) -> Type -> Type) r => Text -> Sem r () #
failLater :: forall (r :: EffectRow) a. Member (Assertion :: (Type -> Type) -> Type -> Type) r => Sem r a -> Sem r a #
warnOnly :: forall (r :: EffectRow) a. Member (Assertion :: (Type -> Type) -> Type -> Type) r => Sem r a -> Sem r a #