proarrow:testing
Safe HaskellNone
LanguageGHC2024

Proarrow.Testing.Laws.Run

Description

Checking laws stated as code (Proarrow.Tools.Laws) in a Testable category: testLaws runs each law with random objects for its variables and random arrows for the ones it asks for, and compares both sides.

The endpoints of a law's equation are built inside the law, so their TestOb cannot be listed up front. Instead the law is run in TESTED k, whose objects are built from leaves by the structures' object formers; there an object's Ob is Tested, which rebuilds the TestOb of the object of k it stands for from the Witnesses passed at run time: one Witness per structure in the law's list, e.g. a WithTestOb2 for Monoidal.

A structure this module does not cover can be added from outside it, in the same way as the ones here:

  • a former for each new kind of object (an open data family, or one of the free category's), with a Tested instance giving its Untest and rebuilding its Ob and TestOb;
  • a Witness instance for the structure, holding how TestOb is closed under its formers;
  • the structure's class instance for TESTED, whose arrows describe themselves (prim for a named arrow, app, infixlDoc, infixrDoc for operations on arrows).
Synopsis

Documentation

testLaws :: forall (cs :: [Kind -> Constraint]) k. (Laws cs, Testable k, All cs (TESTED cs k)) => String -> Witnesses cs k -> TestTree Source Github #

Check the laws of Laws cs in k, one property per law: run each law in TESTED with random objects for its variables and random arrows for the ones it asks for. The Witnesses say how TestOb is closed under the structures of cs (see Tested).

testLawsWith :: forall (cs :: [Kind -> Constraint]) k. (Laws cs, Testable k, All cs (TESTED cs k)) => Property (Some k) -> String -> Witnesses cs k -> TestTree Source Github #

testLaws with the objects for the variables drawn from the given generator, e.g. genObSmall where the laws build large objects like exponentials.

testProLaws :: forall {j} {k} (csj :: [Kind -> Constraint]) (csk :: [Kind -> Constraint]) (cl :: (TESTED csj j +-> TESTED csk k) -> Constraint) (p :: j +-> k). (ProLaws cl, TestableProfunctor p, cl (TestedP p :: TESTED csk k -> TESTED csj j -> Type)) => TestOptions -> String -> Witnesses csj j -> Witnesses csk k -> TestTree Source Github #

Check the laws of ProLaws c for the profunctor p, one property per law: run each law with p interpreted as TestedP p, its elements drawn by genProfunctorElt (each picks its two object variables), the other variables of a ProLaw drawn along the chain e ~> c ~> a and b ~> d ~> f where those hom-sets are non-empty, and random arrows for the ones it asks for. The two Witnesses are for the domain j and the codomain k of p, and the TestOptions apply to each law's property.

Witnesses

data family Witness (c :: Kind -> Constraint) k Source Github #

How TestOb is closed under the object formers of the structure c, for the category k. Structures without formers of their own have a witness that holds nothing.

Instances

Instances details
newtype Witness Monoidal k Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

newtype Witness Monoidal k = MonoidalW (WithTestOb2 k)
data Witness SymMonoidal k Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

data Witness SymMonoidal k = SymMonoidalW
newtype Witness Closed k Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

newtype Witness Closed k = ClosedW (WithTestObExp k)
data Witness CompactClosed k Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

data Witness CompactClosed k = CompactClosedW
data Witness CopyDiscard k Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

data Witness CopyDiscard k = CopyDiscardW
data Witness Distributive k Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

data Witness Distributive k = DistributiveW
newtype Witness StarAutonomous k Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

newtype Witness StarAutonomous k = StarAutonomousW (WithTestObDual k)
data Witness TracedMonoidal k Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

data Witness TracedMonoidal k = TracedW
newtype Witness HasBinaryCoproducts k Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

newtype Witness HasBinaryCoproducts k = CoproductsW (WithTestObCoprod k)
data Witness HasInitialObject k Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

data Witness HasInitialObject k = InitialW
data Witness CategoryOf k Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

data Witness CategoryOf k = CategoryW
newtype Witness HasBinaryProducts k Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

newtype Witness HasBinaryProducts k = ProductsW (WithTestObProd k)
data Witness HasTerminalObject k Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

data Witness HasTerminalObject k = TerminalW
data Witness (Supplies CocommutativeComonoid) k Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

data Witness (Supplies CocommutativeComonoid) k = CocommutativeComonoidSupplyW
data Witness (Supplies CommutativeMonoid) k Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

data Witness (Supplies CommutativeMonoid) k = CommutativeMonoidSupplyW
data Witness (Supplies Comonoid) k Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

data Witness (Supplies Comonoid) k = ComonoidSupplyW
data Witness (Supplies Monoid) k Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

data Witness (Supplies Monoid) k = MonoidSupplyW
data Witness (RepresentedBy csj p) k' Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

data Witness (RepresentedBy csj p) k' = RepresentedW (Witnesses csj j) (WithTestObRep j p)

data Witnesses (cs :: [Kind -> Constraint]) k where Source Github #

One Witness for each structure in cs, in the same order.

Constructors

WNil :: forall k. Witnesses ('[] :: [Kind -> Constraint]) k 
(:&) :: forall (c :: Kind -> Constraint) k (cs1 :: [Kind -> Constraint]). Witness c k -> Witnesses cs1 k -> Witnesses (c ': cs1) k infixr 5 

class HasWitness (c :: Kind -> Constraint) (cs :: [Kind -> Constraint]) where Source Github #

Look up the witness for the structure c.

Methods

witness :: Witnesses cs k -> Witness c k Source Github #

The witness for c in the list.

Instances

Instances details
HasWitness c (c ': cs) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Methods

witness :: Witnesses (c ': cs) k -> Witness c k Source Github #

HasWitness c cs => HasWitness c (d ': cs) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Methods

witness :: Witnesses (d ': cs) k -> Witness c k Source Github #

Interpreting with testable objects

data TESTED (cs :: [Kind -> Constraint]) k Source Github #

Objects of k built from leaves by the structures' object formers. Checking a law interprets it here rather than in k itself: an object's Ob is then Tested, which recovers the TestOb of the object of k it stands for (Untest) from the Witnesses for the structures cs, supplied at run time.

The only constructor is the leaf. Compound objects use the free category's formers, which are open data families of any kind (**!, *!, DualF, ...), so a new structure brings its own former and its own Tested instance.

Constructors

TLeaf k 

Instances

Instances details
(Testable k, Monoidal k, TestOb (Unit :: k)) => Tested (UnitF :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Associated Types

type Untest (UnitF :: TESTED cs k) 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (UnitF :: TESTED cs k) = Unit :: k

Methods

untestOb :: (Ob (Untest (UnitF :: TESTED cs k)) => r) -> r Source Github #

untestTestOb :: Witnesses cs k -> (TestOb (Untest (UnitF :: TESTED cs k)) => r) -> r Source Github #

(Testable k, HasInitialObject k, TestOb (InitialObject :: k)) => Tested (InitF :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Associated Types

type Untest (InitF :: TESTED cs k) 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (InitF :: TESTED cs k) = InitialObject :: k

Methods

untestOb :: (Ob (Untest (InitF :: TESTED cs k)) => r) -> r Source Github #

untestTestOb :: Witnesses cs k -> (TestOb (Untest (InitF :: TESTED cs k)) => r) -> r Source Github #

(Testable k, HasTerminalObject k, TestOb (TerminalObject :: k)) => Tested (TermF :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Associated Types

type Untest (TermF :: TESTED cs k) 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (TermF :: TESTED cs k) = TerminalObject :: k

Methods

untestOb :: (Ob (Untest (TermF :: TESTED cs k)) => r) -> r Source Github #

untestTestOb :: Witnesses cs k -> (TestOb (Untest (TermF :: TESTED cs k)) => r) -> r Source Github #

(HasWitness StarAutonomous cs, StarAutonomous k, Tested a) => Tested (DualF a :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Associated Types

type Untest (DualF a :: TESTED cs k) 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (DualF a :: TESTED cs k) = Dual (Untest a)

Methods

untestOb :: (Ob (Untest (DualF a)) => r) -> r Source Github #

untestTestOb :: Witnesses cs k -> (TestOb (Untest (DualF a)) => r) -> r Source Github #

(HasWitness Monoidal cs, Monoidal k, Tested a, Tested b) => Tested (a **! b :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Associated Types

type Untest (a **! b :: TESTED cs k) 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (a **! b :: TESTED cs k) = Untest a ** Untest b

Methods

untestOb :: (Ob (Untest (a **! b)) => r) -> r Source Github #

untestTestOb :: Witnesses cs k -> (TestOb (Untest (a **! b)) => r) -> r Source Github #

(HasWitness Closed cs, Closed k, Tested a, Tested b) => Tested (a --> b :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Associated Types

type Untest (a --> b :: TESTED cs k) 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (a --> b :: TESTED cs k) = Untest a ~~> Untest b

Methods

untestOb :: (Ob (Untest (a --> b)) => r) -> r Source Github #

untestTestOb :: Witnesses cs k -> (TestOb (Untest (a --> b)) => r) -> r Source Github #

(HasWitness HasBinaryCoproducts cs, HasBinaryCoproducts k, Tested a, Tested b) => Tested (a + b :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Associated Types

type Untest (a + b :: TESTED cs k) 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (a + b :: TESTED cs k) = Untest a || Untest b

Methods

untestOb :: (Ob (Untest (a + b)) => r) -> r Source Github #

untestTestOb :: Witnesses cs k -> (TestOb (Untest (a + b)) => r) -> r Source Github #

(HasWitness HasBinaryProducts cs, HasBinaryProducts k, Tested a, Tested b) => Tested (a *! b :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Associated Types

type Untest (a *! b :: TESTED cs k) 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (a *! b :: TESTED cs k) = Untest a && Untest b

Methods

untestOb :: (Ob (Untest (a *! b)) => r) -> r Source Github #

untestTestOb :: Witnesses cs k -> (TestOb (Untest (a *! b)) => r) -> r Source Github #

(HasWitness (RepresentedBy csj p) csk, Representable p, Tested b) => Tested (RepF p b :: TESTED csk k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Associated Types

type Untest (RepF p b :: TESTED csk k) 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (RepF p b :: TESTED csk k) = p % Untest b

Methods

untestOb :: (Ob (Untest (RepF p b :: TESTED csk k)) => r) -> r Source Github #

untestTestOb :: Witnesses csk k -> (TestOb (Untest (RepF p b :: TESTED csk k)) => r) -> r Source Github #

(HasWitness Monoidal cs, Testable k, Monoidal k, TestOb (Unit :: k)) => Monoidal (TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Associated Types

type Unit 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Unit = UnitF :: TESTED cs k

Methods

withOb2 :: forall (a :: TESTED cs k) (b :: TESTED cs k) r. (Ob a, Ob b) => (Ob (a ** b) => r) -> r

leftUnitor :: forall (a :: TESTED cs k). Ob a => ((Unit :: TESTED cs k) ** a) ~> a

leftUnitorInv :: forall (a :: TESTED cs k). Ob a => a ~> ((Unit :: TESTED cs k) ** a)

rightUnitor :: forall (a :: TESTED cs k). Ob a => (a ** (Unit :: TESTED cs k)) ~> a

rightUnitorInv :: forall (a :: TESTED cs k). Ob a => a ~> (a ** (Unit :: TESTED cs k))

associator :: forall (a :: TESTED cs k) (b :: TESTED cs k) (c :: TESTED cs k). (Ob a, Ob b, Ob c) => ((a ** b) ** c) ~> (a ** (b ** c))

associatorInv :: forall (a :: TESTED cs k) (b :: TESTED cs k) (c :: TESTED cs k). (Ob a, Ob b, Ob c) => (a ** (b ** c)) ~> ((a ** b) ** c)

(HasWitness Monoidal cs, Testable k, SymMonoidal k, TestOb (Unit :: k)) => SymMonoidal (TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Methods

swap :: forall (a :: TESTED cs k) (b :: TESTED cs k). (Ob a, Ob b) => (a ** b) ~> (b ** a)

(HasWitness Monoidal cs, HasWitness Closed cs, Testable k, Closed k, TestOb (Unit :: k)) => Closed (TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Methods

withObExp :: forall (a :: TESTED cs k) (b :: TESTED cs k) r. (Ob a, Ob b) => (Ob (a ~~> b) => r) -> r

curry :: forall (a :: TESTED cs k) (b :: TESTED cs k) (c :: TESTED cs k). (Ob a, Ob b) => ((a ** b) ~> c) -> a ~> (b ~~> c)

apply :: forall (a :: TESTED cs k) (b :: TESTED cs k). (Ob a, Ob b) => ((a ~~> b) ** a) ~> b

(^^^) :: forall (a :: TESTED cs k) (b :: TESTED cs k) (x :: TESTED cs k) (y :: TESTED cs k). (b ~> y) -> (x ~> a) -> (a ~~> b) ~> (x ~~> y)

(HasWitness Monoidal cs, HasWitness Closed cs, HasWitness StarAutonomous cs, Testable k, CompactClosed k, TestOb (Unit :: k)) => CompactClosed (TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Methods

distribDual :: forall (a :: TESTED cs k) (b :: TESTED cs k). (Ob a, Ob b) => Dual (a ** b) ~> (Dual a ** Dual b)

dualUnit :: Dual (Unit :: TESTED cs k) ~> (Unit :: TESTED cs k)

dualityUnit :: forall (a :: TESTED cs k). Ob a => (Unit :: TESTED cs k) ~> (a ** Dual a)

dualityCounit :: forall (a :: TESTED cs k). Ob a => (Dual a ** a) ~> (Unit :: TESTED cs k)

(HasWitness Monoidal cs, Testable k, CopyDiscard k, TestOb (Unit :: k)) => CopyDiscard (TESTED cs k) Source Github #

Copying and discarding in the category the objects stand for.

Instance details

Defined in Proarrow.Testing.Laws.Run

Methods

copy :: forall (a :: TESTED cs k). Ob a => a ~> (a ** a)

discard :: forall (a :: TESTED cs k). Ob a => a ~> (Unit :: TESTED cs k)

(HasWitness Monoidal cs, HasWitness HasBinaryCoproducts cs, Testable k, Distributive k, TestOb (Unit :: k), TestOb (InitialObject :: k)) => Distributive (TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Methods

distL :: forall (a :: TESTED cs k) (b :: TESTED cs k) (c :: TESTED cs k). (Ob a, Ob b, Ob c) => (a ** (b || c)) ~> ((a ** b) || (a ** c))

distR :: forall (a :: TESTED cs k) (b :: TESTED cs k) (c :: TESTED cs k). (Ob a, Ob b, Ob c) => ((a || b) ** c) ~> ((a ** c) || (b ** c))

absorbL :: forall (a :: TESTED cs k). Ob a => (a ** (InitialObject :: TESTED cs k)) ~> (InitialObject :: TESTED cs k)

absorbR :: forall (a :: TESTED cs k). Ob a => ((InitialObject :: TESTED cs k) ** a) ~> (InitialObject :: TESTED cs k)

(HasWitness Monoidal cs, HasWitness Closed cs, HasWitness StarAutonomous cs, Testable k, StarAutonomous k, TestOb (Unit :: k)) => StarAutonomous (TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Methods

withObDual :: forall (a :: TESTED cs k) r. Ob a => (Ob (Dual a) => r) -> r

dual :: forall (a :: TESTED cs k) (b :: TESTED cs k). (a ~> b) -> Dual b ~> Dual a

dualInv :: forall (a :: TESTED cs k) (b :: TESTED cs k). (Ob a, Ob b) => (Dual a ~> Dual b) -> b ~> a

linDist :: forall (a :: TESTED cs k) (b :: TESTED cs k) (c :: TESTED cs k). (Ob a, Ob b, Ob c) => ((a ** b) ~> Dual c) -> a ~> Dual (b ** c)

linDistInv :: forall (a :: TESTED cs k) (b :: TESTED cs k) (c :: TESTED cs k). (Ob a, Ob b, Ob c) => (a ~> Dual (b ** c)) -> (a ** b) ~> Dual c

doubleNeg :: forall (a :: TESTED cs k). Ob a => Dual (Dual a) ~> a

doubleNegInv :: forall (a :: TESTED cs k). Ob a => a ~> Dual (Dual a)

(HasWitness HasBinaryCoproducts cs, HasBinaryCoproducts k) => HasBinaryCoproducts (TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Methods

withObCoprod :: forall (a :: TESTED cs k) (b :: TESTED cs k) r. (Ob a, Ob b) => (Ob (a || b) => r) -> r

lft :: forall (a :: TESTED cs k) (b :: TESTED cs k). (Ob a, Ob b) => a ~> (a || b)

rgt :: forall (a :: TESTED cs k) (b :: TESTED cs k). (Ob a, Ob b) => b ~> (a || b)

(|||) :: forall (x :: TESTED cs k) (a :: TESTED cs k) (y :: TESTED cs k). (x ~> a) -> (y ~> a) -> (x || y) ~> a

(+++) :: forall (a :: TESTED cs k) (b :: TESTED cs k) (x :: TESTED cs k) (y :: TESTED cs k). (a ~> x) -> (b ~> y) -> (a || b) ~> (x || y)

(Testable k, HasInitialObject k, TestOb (InitialObject :: k)) => HasInitialObject (TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Associated Types

type InitialObject 
Instance details

Defined in Proarrow.Testing.Laws.Run

type InitialObject = InitF :: TESTED cs k

Methods

initiate :: forall (a :: TESTED cs k). Ob a => (InitialObject :: TESTED cs k) ~> a

CategoryOf k => CategoryOf (TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Associated Types

type (~>) 
Instance details

Defined in Proarrow.Testing.Laws.Run

type (~>) = TestedArr :: TESTED cs k -> TESTED cs k -> Type
(HasWitness HasBinaryProducts cs, HasBinaryProducts k) => HasBinaryProducts (TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Methods

withObProd :: forall (a :: TESTED cs k) (b :: TESTED cs k) r. (Ob a, Ob b) => (Ob (a && b) => r) -> r

fst :: forall (a :: TESTED cs k) (b :: TESTED cs k). (Ob a, Ob b) => (a && b) ~> a

snd :: forall (a :: TESTED cs k) (b :: TESTED cs k). (Ob a, Ob b) => (a && b) ~> b

(&&&) :: forall (a :: TESTED cs k) (x :: TESTED cs k) (y :: TESTED cs k). (a ~> x) -> (a ~> y) -> a ~> (x && y)

(***) :: forall (a :: TESTED cs k) (b :: TESTED cs k) (x :: TESTED cs k) (y :: TESTED cs k). (a ~> x) -> (b ~> y) -> (a && b) ~> (x && y)

(Testable k, HasTerminalObject k, TestOb (TerminalObject :: k)) => HasTerminalObject (TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Associated Types

type TerminalObject 
Instance details

Defined in Proarrow.Testing.Laws.Run

type TerminalObject = TermF :: TESTED cs k

Methods

terminate :: forall (a :: TESTED cs k). Ob a => a ~> (TerminalObject :: TESTED cs k)

CategoryOf k => Labelled (TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Methods

label :: forall (a :: TESTED cs k) (b :: TESTED cs k). String -> (a ~> b) -> a ~> b

(HasWitness Monoidal cs, Testable k, SymMonoidal k, Supplies CocommutativeComonoid k, TestOb (Unit :: k), Tested a) => CocommutativeComonoid (a :: TESTED cs k) Source Github #

The comonoids of a category that supplies cocommutative ones are cocommutative.

Instance details

Defined in Proarrow.Testing.Laws.Run

(HasWitness Monoidal cs, Testable k, SymMonoidal k, Supplies CommutativeMonoid k, TestOb (Unit :: k), Tested a) => CommutativeMonoid (a :: TESTED cs k) Source Github #

The monoids of a category that supplies commutative ones are commutative.

Instance details

Defined in Proarrow.Testing.Laws.Run

(HasWitness Monoidal cs, Testable k, Monoidal k, Supplies Comonoid k, TestOb (Unit :: k), Tested a) => Comonoid (a :: TESTED cs k) Source Github #

Every object is a comonoid when the category supplies them.

Instance details

Defined in Proarrow.Testing.Laws.Run

Methods

counit :: a ~> (Unit :: TESTED cs k)

comult :: a ~> (a ** a)

(HasWitness Monoidal cs, Testable k, Monoidal k, Supplies Monoid k, TestOb (Unit :: k), Tested a) => Monoid (a :: TESTED cs k) Source Github #

Every object is a monoid when the category supplies them, with the monoid of the object it stands for.

Instance details

Defined in Proarrow.Testing.Laws.Run

Methods

mempty :: (Unit :: TESTED cs k) ~> a

mappend :: (a ** a) ~> a

(HasWitness Monoidal cs, Testable k, Monoidal k, Costrong (Tensor :: k -> (k, k) -> Type) p, TestOb (Unit :: k)) => Costrong (Tensor :: TESTED cs k -> (TESTED cs k, TESTED cs k) -> Type) (TestedP p :: TESTED cs k -> TESTED cs k -> Type) Source Github #

coact over the tensor of p, e.g. the trace of the category the objects stand for.

Instance details

Defined in Proarrow.Testing.Laws.Run

Methods

coact :: forall (a :: TESTED cs k) (x :: TESTED cs k) (y :: TESTED cs k). (Ob a, Ob x, Ob y) => TestedP p (Act (Tensor :: TESTED cs k -> (TESTED cs k, TESTED cs k) -> Type) a x) (Act (Tensor :: TESTED cs k -> (TESTED cs k, TESTED cs k) -> Type) a y) -> TestedP p x y

(HasWitness Monoidal csj, HasWitness Monoidal csk, Testable j, Testable k, MonoidalProfunctor p, TestOb (Unit :: j), TestOb (Unit :: k)) => MonoidalProfunctor (TestedP p :: TESTED csk k -> TESTED csj j -> Type) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Methods

one :: TestedP p (Unit :: TESTED csk k) (Unit :: TESTED csj j)

(**) :: forall (x1 :: TESTED csk k) (x2 :: TESTED csj j) (y1 :: TESTED csk k) (y2 :: TESTED csj j). TestedP p x1 x2 -> TestedP p y1 y2 -> TestedP p (x1 ** y1) (x2 ** y2)

Profunctor p => Profunctor (TestedP p :: TESTED csk k -> TESTED csj j -> Type) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Methods

dimap :: forall (c :: TESTED csk k) (a :: TESTED csk k) (b :: TESTED csj j) (d :: TESTED csj j). (c ~> a) -> (b ~> d) -> TestedP p a b -> TestedP p c d

lmap :: forall (c :: TESTED csk k) (a :: TESTED csk k) (b :: TESTED csj j). (c ~> a) -> TestedP p a b -> TestedP p c b

rmap :: forall (b :: TESTED csj j) (d :: TESTED csj j) (a :: TESTED csk k). (b ~> d) -> TestedP p a b -> TestedP p a d

(\\) :: forall (a :: TESTED csk k) (b :: TESTED csj j) r. ((Ob a, Ob b) => r) -> TestedP p a b -> r

(HasWitness (RepresentedBy csj p) csk, Representable p) => Representable (TestedP p :: TESTED csk k -> TESTED csj j -> Type) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Methods

index :: forall (a :: TESTED csk k) (b :: TESTED csj j). TestedP p a b -> a ~> ((TestedP p :: TESTED csk k -> TESTED csj j -> Type) % b)

tabulate :: forall (b :: TESTED csj j) (a :: TESTED csk k). Ob b => (a ~> ((TestedP p :: TESTED csk k -> TESTED csj j -> Type) % b)) -> TestedP p a b

repMap :: forall (a :: TESTED csj j) (b :: TESTED csj j). (a ~> b) -> ((TestedP p :: TESTED csk k -> TESTED csj j -> Type) % a) ~> ((TestedP p :: TESTED csk k -> TESTED csj j -> Type) % b)

repUniv :: forall (a :: TESTED csj j). Ob a => TestedP p ((TestedP p :: TESTED csk k -> TESTED csj j -> Type) % a) a

Promonad p => Promonad (TestedP p :: TESTED cs k -> TESTED cs k -> Type) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Methods

id :: forall (a :: TESTED cs k). Ob a => TestedP p a a

(.) :: forall (b :: TESTED cs k) (c :: TESTED cs k) (a :: TESTED cs k). TestedP p b c -> TestedP p a b -> TestedP p a c

type Untest (UnitF :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (UnitF :: TESTED cs k) = Unit :: k
type Untest (InitF :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (InitF :: TESTED cs k) = InitialObject :: k
type Untest (TermF :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (TermF :: TESTED cs k) = TerminalObject :: k
type Untest (DualF a :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (DualF a :: TESTED cs k) = Dual (Untest a)
type Untest (a **! b :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (a **! b :: TESTED cs k) = Untest a ** Untest b
type Untest (a --> b :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (a --> b :: TESTED cs k) = Untest a ~~> Untest b
type Untest (a + b :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (a + b :: TESTED cs k) = Untest a || Untest b
type Untest (a *! b :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (a *! b :: TESTED cs k) = Untest a && Untest b
type Untest (RepF p b :: TESTED csk k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (RepF p b :: TESTED csk k) = p % Untest b
type Unit Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Unit = UnitF :: TESTED cs k
type InitialObject Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

type InitialObject = InitF :: TESTED cs k
type (~>) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

type (~>) = TestedArr :: TESTED cs k -> TESTED cs k -> Type
type TerminalObject Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

type TerminalObject = TermF :: TESTED cs k
type Dual (a :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Dual (a :: TESTED cs k) = DualF a
type Ob (a :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Ob (a :: TESTED cs k) = Tested a
type (a :: TESTED cs k) ** (b :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

type (a :: TESTED cs k) ** (b :: TESTED cs k) = a **! b
type (a :: TESTED cs k) ~~> (b :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

type (a :: TESTED cs k) ~~> (b :: TESTED cs k) = a --> b
type (a :: TESTED cs k) || (b :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

type (a :: TESTED cs k) || (b :: TESTED cs k) = a + b
type (a :: TESTED cs k) && (b :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

type (a :: TESTED cs k) && (b :: TESTED cs k) = a *! b
type (TestedP p :: TESTED csk k -> TESTED csj j -> Type) % (b :: TESTED csj j) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

type (TestedP p :: TESTED csk k -> TESTED csj j -> Type) % (b :: TESTED csj j) = RepF p b :: TESTED csk k

class Tested (a :: TESTED cs k) where Source Github #

The objects of TESTED: those that stand for an object of k (Untest), with how to rebuild that object's Ob and TestOb from the ones of its parts. This is Ob for TESTED.

Associated Types

type Untest (a :: TESTED cs k) :: k Source Github #

The object of k that a stands for. (The class variable is re-annotated so that k is in scope in the result kind.)

Methods

untestOb :: (Ob (Untest a) => r) -> r Source Github #

The Ob of the object a stands for, which the structures of k provide.

untestTestOb :: Witnesses cs k -> (TestOb (Untest a) => r) -> r Source Github #

The TestOb of the object a stands for, which the witnesses provide.

Instances

Instances details
(Testable k, Monoidal k, TestOb (Unit :: k)) => Tested (UnitF :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Associated Types

type Untest (UnitF :: TESTED cs k) 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (UnitF :: TESTED cs k) = Unit :: k

Methods

untestOb :: (Ob (Untest (UnitF :: TESTED cs k)) => r) -> r Source Github #

untestTestOb :: Witnesses cs k -> (TestOb (Untest (UnitF :: TESTED cs k)) => r) -> r Source Github #

(Testable k, HasInitialObject k, TestOb (InitialObject :: k)) => Tested (InitF :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Associated Types

type Untest (InitF :: TESTED cs k) 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (InitF :: TESTED cs k) = InitialObject :: k

Methods

untestOb :: (Ob (Untest (InitF :: TESTED cs k)) => r) -> r Source Github #

untestTestOb :: Witnesses cs k -> (TestOb (Untest (InitF :: TESTED cs k)) => r) -> r Source Github #

(Testable k, HasTerminalObject k, TestOb (TerminalObject :: k)) => Tested (TermF :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Associated Types

type Untest (TermF :: TESTED cs k) 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (TermF :: TESTED cs k) = TerminalObject :: k

Methods

untestOb :: (Ob (Untest (TermF :: TESTED cs k)) => r) -> r Source Github #

untestTestOb :: Witnesses cs k -> (TestOb (Untest (TermF :: TESTED cs k)) => r) -> r Source Github #

(HasWitness StarAutonomous cs, StarAutonomous k, Tested a) => Tested (DualF a :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Associated Types

type Untest (DualF a :: TESTED cs k) 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (DualF a :: TESTED cs k) = Dual (Untest a)

Methods

untestOb :: (Ob (Untest (DualF a)) => r) -> r Source Github #

untestTestOb :: Witnesses cs k -> (TestOb (Untest (DualF a)) => r) -> r Source Github #

(HasWitness Monoidal cs, Monoidal k, Tested a, Tested b) => Tested (a **! b :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Associated Types

type Untest (a **! b :: TESTED cs k) 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (a **! b :: TESTED cs k) = Untest a ** Untest b

Methods

untestOb :: (Ob (Untest (a **! b)) => r) -> r Source Github #

untestTestOb :: Witnesses cs k -> (TestOb (Untest (a **! b)) => r) -> r Source Github #

(HasWitness Closed cs, Closed k, Tested a, Tested b) => Tested (a --> b :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Associated Types

type Untest (a --> b :: TESTED cs k) 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (a --> b :: TESTED cs k) = Untest a ~~> Untest b

Methods

untestOb :: (Ob (Untest (a --> b)) => r) -> r Source Github #

untestTestOb :: Witnesses cs k -> (TestOb (Untest (a --> b)) => r) -> r Source Github #

(HasWitness HasBinaryCoproducts cs, HasBinaryCoproducts k, Tested a, Tested b) => Tested (a + b :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Associated Types

type Untest (a + b :: TESTED cs k) 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (a + b :: TESTED cs k) = Untest a || Untest b

Methods

untestOb :: (Ob (Untest (a + b)) => r) -> r Source Github #

untestTestOb :: Witnesses cs k -> (TestOb (Untest (a + b)) => r) -> r Source Github #

(HasWitness HasBinaryProducts cs, HasBinaryProducts k, Tested a, Tested b) => Tested (a *! b :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Associated Types

type Untest (a *! b :: TESTED cs k) 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (a *! b :: TESTED cs k) = Untest a && Untest b

Methods

untestOb :: (Ob (Untest (a *! b)) => r) -> r Source Github #

untestTestOb :: Witnesses cs k -> (TestOb (Untest (a *! b)) => r) -> r Source Github #

(Testable k, TestOb a) => Tested ('TLeaf a :: TESTED cs k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Associated Types

type Untest ('TLeaf a :: TESTED cs k) 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest ('TLeaf a :: TESTED cs k) = a

Methods

untestOb :: (Ob (Untest ('TLeaf a :: TESTED cs k)) => r) -> r Source Github #

untestTestOb :: Witnesses cs k -> (TestOb (Untest ('TLeaf a :: TESTED cs k)) => r) -> r Source Github #

(HasWitness (RepresentedBy csj p) csk, Representable p, Tested b) => Tested (RepF p b :: TESTED csk k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Associated Types

type Untest (RepF p b :: TESTED csk k) 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (RepF p b :: TESTED csk k) = p % Untest b

Methods

untestOb :: (Ob (Untest (RepF p b :: TESTED csk k)) => r) -> r Source Github #

untestTestOb :: Witnesses csk k -> (TestOb (Untest (RepF p b :: TESTED csk k)) => r) -> r Source Github #

untestOb2 :: forall {cs1 :: [Kind -> Constraint]} {k1} {cs2 :: [Kind -> Constraint]} {k2} (a :: TESTED cs2 k2) (b :: TESTED cs1 k1) r. (Tested a, Tested b) => ((Ob (Untest a), Ob (Untest b)) => r) -> r Source Github #

untestOb of two objects at once.

untestOb3 :: forall {cs1 :: [Kind -> Constraint]} {k1} {cs2 :: [Kind -> Constraint]} {k2} {cs3 :: [Kind -> Constraint]} {k3} (a :: TESTED cs3 k3) (b :: TESTED cs1 k1) (c :: TESTED cs2 k2) r. (Tested a, Tested b, Tested c) => ((Ob (Untest a), Ob (Untest b), Ob (Untest c)) => r) -> r Source Github #

untestOb of three objects at once.

untestTestOb2 :: forall {cs :: [Kind -> Constraint]} {k} (a :: TESTED cs k) (b :: TESTED cs k) r. (Tested a, Tested b) => Witnesses cs k -> ((TestOb (Untest a), TestOb (Untest b)) => r) -> r Source Github #

untestTestOb of two objects at once.

type TestedArr = TestedP (Hom k) :: TESTED cs k -> TESTED cs k -> Type Source Github #

An arrow of k between the objects the endpoints stand for, with a description of how it was built: an element of the hom profunctor. These are the arrows of TESTED.

pattern TestedArr :: forall cs k a b. () => (Tested a, Tested b) => Doc -> (Untest a ~> Untest b) -> TestedArr a b Source Github #

TestedP at the hom profunctor.

Interpreting profunctors

data TestedP (p :: j +-> k) (a :: TESTED csk k) (b :: TESTED csj j) where Source Github #

An element of p between the objects the endpoints stand for, with a description of how it was built, for printing a failing law.

Constructors

TestedP :: forall {csk :: [Kind -> Constraint]} {k} {csj :: [Kind -> Constraint]} {j} (a :: TESTED csk k) (b :: TESTED csj j) (p :: j +-> k). (Tested a, Tested b) => Doc -> p (Untest a) (Untest b) -> TestedP p a b 

Instances

Instances details
(HasWitness Monoidal cs, Testable k, Monoidal k, Costrong (Tensor :: k -> (k, k) -> Type) p, TestOb (Unit :: k)) => Costrong (Tensor :: TESTED cs k -> (TESTED cs k, TESTED cs k) -> Type) (TestedP p :: TESTED cs k -> TESTED cs k -> Type) Source Github #

coact over the tensor of p, e.g. the trace of the category the objects stand for.

Instance details

Defined in Proarrow.Testing.Laws.Run

Methods

coact :: forall (a :: TESTED cs k) (x :: TESTED cs k) (y :: TESTED cs k). (Ob a, Ob x, Ob y) => TestedP p (Act (Tensor :: TESTED cs k -> (TESTED cs k, TESTED cs k) -> Type) a x) (Act (Tensor :: TESTED cs k -> (TESTED cs k, TESTED cs k) -> Type) a y) -> TestedP p x y

(HasWitness Monoidal csj, HasWitness Monoidal csk, Testable j, Testable k, MonoidalProfunctor p, TestOb (Unit :: j), TestOb (Unit :: k)) => MonoidalProfunctor (TestedP p :: TESTED csk k -> TESTED csj j -> Type) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Methods

one :: TestedP p (Unit :: TESTED csk k) (Unit :: TESTED csj j)

(**) :: forall (x1 :: TESTED csk k) (x2 :: TESTED csj j) (y1 :: TESTED csk k) (y2 :: TESTED csj j). TestedP p x1 x2 -> TestedP p y1 y2 -> TestedP p (x1 ** y1) (x2 ** y2)

Profunctor p => Profunctor (TestedP p :: TESTED csk k -> TESTED csj j -> Type) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Methods

dimap :: forall (c :: TESTED csk k) (a :: TESTED csk k) (b :: TESTED csj j) (d :: TESTED csj j). (c ~> a) -> (b ~> d) -> TestedP p a b -> TestedP p c d

lmap :: forall (c :: TESTED csk k) (a :: TESTED csk k) (b :: TESTED csj j). (c ~> a) -> TestedP p a b -> TestedP p c b

rmap :: forall (b :: TESTED csj j) (d :: TESTED csj j) (a :: TESTED csk k). (b ~> d) -> TestedP p a b -> TestedP p a d

(\\) :: forall (a :: TESTED csk k) (b :: TESTED csj j) r. ((Ob a, Ob b) => r) -> TestedP p a b -> r

(HasWitness (RepresentedBy csj p) csk, Representable p) => Representable (TestedP p :: TESTED csk k -> TESTED csj j -> Type) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Methods

index :: forall (a :: TESTED csk k) (b :: TESTED csj j). TestedP p a b -> a ~> ((TestedP p :: TESTED csk k -> TESTED csj j -> Type) % b)

tabulate :: forall (b :: TESTED csj j) (a :: TESTED csk k). Ob b => (a ~> ((TestedP p :: TESTED csk k -> TESTED csj j -> Type) % b)) -> TestedP p a b

repMap :: forall (a :: TESTED csj j) (b :: TESTED csj j). (a ~> b) -> ((TestedP p :: TESTED csk k -> TESTED csj j -> Type) % a) ~> ((TestedP p :: TESTED csk k -> TESTED csj j -> Type) % b)

repUniv :: forall (a :: TESTED csj j). Ob a => TestedP p ((TestedP p :: TESTED csk k -> TESTED csj j -> Type) % a) a

Promonad p => Promonad (TestedP p :: TESTED cs k -> TESTED cs k -> Type) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Methods

id :: forall (a :: TESTED cs k). Ob a => TestedP p a a

(.) :: forall (b :: TESTED cs k) (c :: TESTED cs k) (a :: TESTED cs k). TestedP p b c -> TestedP p a b -> TestedP p a c

type (TestedP p :: TESTED csk k -> TESTED csj j -> Type) % (b :: TESTED csj j) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

type (TestedP p :: TESTED csk k -> TESTED csj j -> Type) % (b :: TESTED csj j) = RepF p b :: TESTED csk k

data family RepF (p :: j +-> k) (b :: TESTED csj j) :: o Source Github #

The object p % b, for the interpretation of a Representable p.

Instances

Instances details
(HasWitness (RepresentedBy csj p) csk, Representable p, Tested b) => Tested (RepF p b :: TESTED csk k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Associated Types

type Untest (RepF p b :: TESTED csk k) 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (RepF p b :: TESTED csk k) = p % Untest b

Methods

untestOb :: (Ob (Untest (RepF p b :: TESTED csk k)) => r) -> r Source Github #

untestTestOb :: Witnesses csk k -> (TestOb (Untest (RepF p b :: TESTED csk k)) => r) -> r Source Github #

type Untest (RepF p b :: TESTED csk k) Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

type Untest (RepF p b :: TESTED csk k) = p % Untest b

class RepresentedBy (csj :: [Kind -> Constraint]) (p :: j +-> k) k' Source Github #

The structure of being closed under the representing functor of p, whose objects in TESTED are formed by RepF. Its witness needs the witnesses of the domain j of p, csj.

Instances

Instances details
RepresentedBy csj (p :: j +-> k) k' Source Github # 
Instance details

Defined in Proarrow.Testing.Laws.Run

Describing arrows

type Doc = Int -> ShowS Source Github #

A description that can be shown at a precedence, like showsPrec.

prim :: forall {csk :: [Kind -> Constraint]} {k} {csj :: [Kind -> Constraint]} {j} (a :: TESTED csk k) (b :: TESTED csj j) p. (Tested a, Tested b) => String -> p (Untest a) (Untest b) -> TestedP p a b Source Github #

An element or arrow described by its name.

atom :: String -> Doc Source Github #

A name, which never needs parentheses.

app :: String -> Doc -> Doc Source Github #

A function applied to one argument.

apps :: String -> [Doc] -> Doc Source Github #

A function applied to several arguments.

infixlDoc :: Int -> String -> Doc -> Doc -> Doc Source Github #

A left or right associative infix operator at the given precedence, like infixl and infixr. The operator string includes its surrounding spaces, e.g. " . ".

infixrDoc :: Int -> String -> Doc -> Doc -> Doc Source Github #

A left or right associative infix operator at the given precedence, like infixl and infixr. The operator string includes its surrounding spaces, e.g. " . ".