napkin-spec-2.0.0
Safe HaskellNone
LanguageGHC2024

Napkin.Run.Effects.Languages.Assertion

Synopsis

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..

Constructors

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

Instances details
ToDumpItem (b :: k) (Assertion :: (Type -> Type) -> Type -> Type) # 
Instance details

Defined in Napkin.Run.Effects.Interceptors.LogProgram.Types

Methods

toDumpItem :: forall (r :: EffectRow) x. Assertion (Sem r) x -> DumpItem b #

GShow (Assertion a :: Type -> Type) # 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

Methods

gshowsPrec :: Int -> Assertion a a0 -> ShowS #

Show (Assertion a b) # 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

Methods

showsPrec :: Int -> Assertion a b -> ShowS #

show :: Assertion a b -> String #

showList :: [Assertion a b] -> ShowS #

Eq (Assertion a b) # 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

Methods

(==) :: Assertion a b -> Assertion a b -> Bool #

(/=) :: Assertion a b -> Assertion a b -> Bool #

newtype AssertionGroup #

Constructors

AssertionGroup [Text] 

Instances

Instances details
Default AssertionGroup # 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

Methods

def :: AssertionGroup #

Monoid AssertionGroup # 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

Semigroup AssertionGroup # 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

Generic AssertionGroup # 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

Associated Types

type Rep AssertionGroup 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

type Rep AssertionGroup = D1 ('MetaData "AssertionGroup" "Napkin.Run.Effects.Languages.Assertion" "napkin-spec-2.0.0-7NH5JHRFo7V8BQP5NCfMo1" 'True) (C1 ('MetaCons "AssertionGroup" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text])))
Show AssertionGroup # 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

Eq AssertionGroup # 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

type Rep AssertionGroup # 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

type Rep AssertionGroup = D1 ('MetaData "AssertionGroup" "Napkin.Run.Effects.Languages.Assertion" "napkin-spec-2.0.0-7NH5JHRFo7V8BQP5NCfMo1" 'True) (C1 ('MetaCons "AssertionGroup" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text])))

newtype AssertionLog #

Instances

Instances details
Monoid AssertionLog # 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

Semigroup AssertionLog # 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

Generic AssertionLog # 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

Associated Types

type Rep AssertionLog 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

type Rep AssertionLog = D1 ('MetaData "AssertionLog" "Napkin.Run.Effects.Languages.Assertion" "napkin-spec-2.0.0-7NH5JHRFo7V8BQP5NCfMo1" 'True) (C1 ('MetaCons "AssertionLog" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [AssertionEntry])))
Show AssertionLog # 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

Eq AssertionLog # 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

type Rep AssertionLog # 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

type Rep AssertionLog = D1 ('MetaData "AssertionLog" "Napkin.Run.Effects.Languages.Assertion" "napkin-spec-2.0.0-7NH5JHRFo7V8BQP5NCfMo1" 'True) (C1 ('MetaCons "AssertionLog" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [AssertionEntry])))

data AssertionEntry #

Instances

Instances details
Generic AssertionEntry # 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

Associated Types

type Rep AssertionEntry 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

type Rep AssertionEntry = D1 ('MetaData "AssertionEntry" "Napkin.Run.Effects.Languages.Assertion" "napkin-spec-2.0.0-7NH5JHRFo7V8BQP5NCfMo1" 'False) (C1 ('MetaCons "AssertionEntry" 'PrefixI 'True) ((S1 ('MetaSel ('Just "assertionGroup") '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))))
Show AssertionEntry # 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

Eq AssertionEntry # 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

type Rep AssertionEntry # 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

type Rep AssertionEntry = D1 ('MetaData "AssertionEntry" "Napkin.Run.Effects.Languages.Assertion" "napkin-spec-2.0.0-7NH5JHRFo7V8BQP5NCfMo1" 'False) (C1 ('MetaCons "AssertionEntry" 'PrefixI 'True) ((S1 ('MetaSel ('Just "assertionGroup") '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 #

Constructors

Success 
Failure (Maybe Text) 

Instances

Instances details
ToJSON AssertionStatus # 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

Generic AssertionStatus # 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

Associated Types

type Rep AssertionStatus 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

type Rep AssertionStatus = D1 ('MetaData "AssertionStatus" "Napkin.Run.Effects.Languages.Assertion" "napkin-spec-2.0.0-7NH5JHRFo7V8BQP5NCfMo1" '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))))
Show AssertionStatus # 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

Eq AssertionStatus # 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

type Rep AssertionStatus # 
Instance details

Defined in Napkin.Run.Effects.Languages.Assertion

type Rep AssertionStatus = D1 ('MetaData "AssertionStatus" "Napkin.Run.Effects.Languages.Assertion" "napkin-spec-2.0.0-7NH5JHRFo7V8BQP5NCfMo1" '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))))

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.

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 () #

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 #

assertionToAssertionEntry :: forall {k} (r :: k) a. Assertion r a -> AssertionEntry #