You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Operations to define and use Specifications](#operations-to-define-and-use-specifications)
42
-
-[Utility functions](#utility-functions)
43
-
-[Escape Hatch to QuickCheck Gen monad](#escape-hatch-to-quickcheck-gen-monad)
44
-
-[Strategy for constraining a large type with many nested sub-components.](#strategy-for-constraining-a-large-type-with-many-nested-sub-components)
45
-
-[Writing HasSpec instances by hand.](#writing-hasspec-instances-by-hand)
46
-
-[Strategy 1 using GHC.Generics](#strategy-1-using-ghcgenerics)
47
-
-[Strategy 2 writing your own SimpleRep instance](#strategy-2-writing-your-own-simplerep-instance)
48
-
-[Strategy 3 defining the SimpleRep instance in terms of another type with a SimpleRep instance](#strategy-3-defining-the-simplerep-instance-in-terms-of-another-type-with-a-simplerep-instance)
49
-
-[Strategy 4, bypassing SimpleRep, and write the HasSpec instance by Hand](#strategy-4-bypassing-simplerep-and-write-the-hasspec-instance-by-hand)
50
-
-[A look into the internals of the system.](#a-look-into-the-internals-of-the-system)
51
-
52
-
<!-- markdown-toc end -->
53
-
54
8
## Constrained Generators is a First-Order Logic
55
9
56
10
A First-order typed logic (FOTL) has 4 components, where each component uses types to ensure well-formedness.
@@ -1544,14 +1498,13 @@ class Typeable (SimpleRep a) => HasSimpleRep a where
1544
1498
1545
1499
What kind oftype lends itself to this strategy?
1546
1500
1.Atype that has internal structure that enforces some internal invariants.
1547
-
2.Atype that has a -builder- function, that takes simple input, and constructs the internal struture.
1548
-
3.Atype that has an -accessor- function, that takes the internal structure, and returns the simple input.
1549
-
4.Atypewhere the -simple input- has a Sum-of-Products representation.
1501
+
2.Atype that has a _builder_ function, that takes simple input, and constructs the internal struture.
1502
+
3.Atype that has an _accessor_ function, that takes the internal structure, and returns the simple input.
1503
+
4.Atypewhere the _simple input_ has a Sum-of-Products representation.
1550
1504
1551
-
Often the -builder- function is implemented as a HaskellPattern.Here is an example that come from the CardanoLedger.
1505
+
Often the _builder_ function is implemented as a HaskellPattern.Here is an example that come from the CardanoLedger.
1552
1506
A lot of complicated stuff is not fully describe here, but the example gives an overview of how it works.
1553
1507
1554
-
1555
1508
```haskell
1556
1509
-- NOTE: this is a representation of the `ShelleyTxOut` type. You can't
1557
1510
-- simply use the generics to derive the `SimpleRep` for `ShelleyTxOut`
@@ -1575,8 +1528,8 @@ instance (Era era, Val (Value era)) => HasSimpleRep (ShelleyTxOut era) where
0 commit comments