|
| 1 | +/** Common Types of the Refabricator Library |
| 2 | + * |
| 3 | + * - Fabrics consist of a name and the actual content |
| 4 | + * - a fabric is a function taking a unit and returning a name and the actual content |
| 5 | + * - a fabricator is "generator" of fabrics |
| 6 | + * - a refabricator manipulates the result of a fabric |
| 7 | + * - a factory produces the SSG's output based on fabrics and their manipulations of refabricators |
| 8 | + * - an appliedFactory is an already configure factory which takes fabrics and processes them |
| 9 | + */ |
| 10 | + |
1 | 11 | type name = string;
|
| 12 | +/** Name of the result of a fabric */ |
| 13 | + |
2 | 14 | type content = string;
|
| 15 | +/** Content of the result of a fabric */ |
| 16 | + |
3 | 17 | type t = (name, content);
|
| 18 | +/** Result of a fabric */ |
| 19 | + |
4 | 20 | type fabric = unit => t;
|
| 21 | +/** A fabric is a generator function for a source. |
| 22 | + * The function can be called later on to actually fetch sources |
| 23 | + * aka "lazyly loaded source" |
| 24 | + */ |
| 25 | + |
5 | 26 | type fabrics = list(fabric);
|
| 27 | +/** Multiple fabrics |
| 28 | + * aka "multiple lazyly loaded sources" |
| 29 | + */ |
| 30 | + |
6 | 31 | type fabricator('a) = 'a => fabrics;
|
| 32 | +/** Constructor of multple fabrics. |
| 33 | + * Each concrete type of fabricator has it's own set of arguments. |
| 34 | + * aka "loader of fabrics" |
| 35 | + */ |
| 36 | + |
7 | 37 | type refabricator('a) = ('a, fabrics) => fabrics;
|
| 38 | +/** Manipulates fabrics |
| 39 | + * Each concrete type of refabricator has it's own set of arguments |
| 40 | + * aka "rewriter of source's content" |
| 41 | + */ |
| 42 | + |
8 | 43 | type factory('a) = ('a, fabrics) => result(unit, string);
|
| 44 | +/** Construct an `appliedFactory`, which will process fabrics (e.g. write them to file) |
| 45 | + * aka "Processor of fetched & manipulated content" |
| 46 | + */ |
| 47 | + |
9 | 48 | type appliedFactory = fabrics => result(unit, string);
|
| 49 | +/** Construct an `appliedFactory`, which will process fabrics (e.g. write them to file) |
| 50 | + * aka "Processor of fetched & manipulated content" |
| 51 | + */ |
0 commit comments