@@ -4,38 +4,37 @@ import polynomial.mermaid.Mermaid.CustomLabels
4
4
import polynomial .mermaid .render .p .MermaidP
5
5
import polynomial .mermaid .render .q .MermaidQ
6
6
import polynomial .mermaid .render .Format .{Cardinal , Generic , Specific }
7
- import polynomial .mermaid .render .{Render }
8
- import polynomial .mermaid .render .addTitle
7
+ import polynomial .mermaid .render .{Render , addTitle }
9
8
import polynomial .morphism .PolyMap
10
9
import polynomial .`object` .{Binomial , Monomial , Store }
11
10
12
11
trait Mermaid [F [_]]:
13
12
def showGraph (graphFmt : Format ): String
14
- def showGraphCustom (graphFmt : Format , labels : CustomLabels [F ]): String
13
+ def showGraphCustom [ Y ] (graphFmt : Format , labels : CustomLabels [F [ Y ] ]): String
15
14
def showTitle (titleFmt : Format ): String
16
- def showTitleCustom (labels : CustomLabels [F ]): String
15
+ def showTitleCustom [ Y ] (labels : CustomLabels [F [ Y ] ]): String
17
16
def showTitleHtml (titleFmt : Format ): String
18
- def showTitleHtmlCustom (labels : CustomLabels [F ]): String
17
+ def showTitleHtmlCustom [ Y ] (labels : CustomLabels [F [ Y ] ]): String
19
18
def showTitledGraph (titleFmt : Format , graphFmt : Format ): String
20
- def showTitledGraphCustom (graphFmt : Format , labels : CustomLabels [F ]): String
19
+ def showTitledGraphCustom [ Y ] (graphFmt : Format , labels : CustomLabels [F [ Y ] ]): String
21
20
22
21
object Mermaid :
23
22
24
- type ParamLabels [P [_]] = P [ Any ] match
25
- case Monomial [a, b, Any ] => (String , String )
26
- case Binomial [a1, b1, a2, b2, Any ] => ((String , String ), (String , String ))
27
- case Store [s, Any ] => String
23
+ type ParamLabels [X ] = X match
24
+ case Monomial [a, b, y ] => (String , String )
25
+ case Binomial [a1, b1, a2, b2, y ] => ((String , String ), (String , String ))
26
+ case Store [s, y ] => String
28
27
29
- type PolynomialLabels [P [_]] = P [ Any ] match
30
- case Binomial [a1, b1, a2, b2, Any ] => String
31
- case Monomial [a, b, Any ] => String
32
- case Store [s, Any ] => String
28
+ type PolynomialLabels [X ] = X match
29
+ case Binomial [a1, b1, a2, b2, y ] => String
30
+ case Monomial [a, b, y ] => String
31
+ case Store [s, y ] => String
33
32
34
- type CustomLabels [P [_]] = P [ Any ] match
35
- case PolyMap [Binomial [a1, b1, a2, b2, _], Monomial [a3, b3, _], Any ] => ( String , String )
36
- case PolyMap [ Monomial [a, b, _ ], Monomial [a3, b3, _], Any ] => (String , String )
37
- case PolyMap [ Store [s, _ ], Monomial [a3, b3, _], Any ] => (String , String )
38
- case PolyMap [ Store [s, _ ], Binomial [a1, b1, a2, b2, _], Any ] => (String , String )
33
+ type CustomLabels [X ] = X match
34
+ case PolyMap [p, q, y] => CustomLabels [(p[y], q[y])]
35
+ case ( Monomial [a1, b1, y1 ], Monomial [a2, b2, y2]) => (String , String )
36
+ case ( Store [s, y1 ], Binomial [a1, b1, a2, b2, y2]) => (String , String )
37
+ case ( Store [s, y1 ], Monomial [a, b, y2]) => (String , String )
39
38
40
39
given mooreStoreToMono [S , A , B ](using
41
40
P : MermaidP [Store [S , _]],
@@ -53,7 +52,7 @@ object Mermaid:
53
52
Render .mermaidCodeFence(Q .graphQGeneric((labelA, labelB))(P .graphPGeneric(P .polynomialGeneric(labelS), labelS)))
54
53
case Specific =>
55
54
Render .mermaidCodeFence(Q .graphQSpecific(P .graphPSpecific(P .polynomialSpecific)))
56
- def showGraphCustom (graphFmt : Format , labels : (String , String )): String =
55
+ def showGraphCustom [ Y ] (graphFmt : Format , labels : (String , String )): String =
57
56
graphFmt match
58
57
case Cardinal =>
59
58
Render .mermaidCodeFence(Q .graphQCardinal(P .graphPCardinal(P .polynomialCardinal)))
@@ -69,7 +68,7 @@ object Mermaid:
69
68
Render .mermaidCodeFence(Render .title(P .polynomialGeneric(labelS), 3 , Q .polynomialGeneric((labelA, labelB)), 3 ))
70
69
case Specific =>
71
70
Render .mermaidCodeFence(Render .title(P .polynomialSpecific, 3 , Q .polynomialSpecific, 3 ))
72
- def showTitleCustom (labels : (String , String )): String =
71
+ def showTitleCustom [ Y ] (labels : (String , String )): String =
73
72
Render .mermaidCodeFence(Render .title(labels._1, 3 , labels._2, 3 ))
74
73
def showTitleHtml (titleFmt : Format ): String =
75
74
titleFmt match
@@ -79,7 +78,7 @@ object Mermaid:
79
78
Render .polyMap(P .graphPGeneric(P .polynomialGeneric(labelS), labelS), Q .graphQGeneric((labelA, labelB))(P .graphPGeneric(P .polynomialGeneric(labelS), labelS)))
80
79
case Specific =>
81
80
Render .polyMap(P .graphPSpecific(P .polynomialSpecific), Q .graphQSpecific(P .graphPSpecific(P .polynomialSpecific)))
82
- def showTitleHtmlCustom (labels : (String , String )): String =
81
+ def showTitleHtmlCustom [ Y ] (labels : (String , String )): String =
83
82
Render .polyMap(labels._1, labels._2)
84
83
def showTitledGraph (titleFmt : Format , graphFmt : Format ): String =
85
84
(titleFmt, graphFmt) match
@@ -110,7 +109,7 @@ object Mermaid:
110
109
case (Specific , Specific ) =>
111
110
Render .mermaidCodeFence(Q .graphQSpecific(P .graphPSpecific(P .polynomialSpecific)))
112
111
.addTitle(P .polynomialSpecific, 3 , Q .polynomialSpecific, 3 )
113
- def showTitledGraphCustom (graphFmt : Format , labels : (String , String )): String =
112
+ def showTitledGraphCustom [ Y ] (graphFmt : Format , labels : (String , String )): String =
114
113
graphFmt match
115
114
case Cardinal =>
116
115
Render .mermaidCodeFence(Q .graphQCardinal(P .graphPCardinal(P .polynomialCardinal)))
@@ -138,7 +137,7 @@ object Mermaid:
138
137
Render .mermaidCodeFence(Q .graphQGeneric((labelA, labelB))(P .graphPGeneric(P .polynomialGeneric(labelS), labelS)))
139
138
case Specific =>
140
139
Render .mermaidCodeFence(Q .graphQSpecific(P .graphPSpecific(P .polynomialSpecific)))
141
- def showGraphCustom (graphFmt : Format , labels : (String , String )): String =
140
+ def showGraphCustom [ Y ] (graphFmt : Format , labels : (String , String )): String =
142
141
graphFmt match
143
142
case Cardinal =>
144
143
Render .mermaidCodeFence(Q .graphQCardinal(P .graphPCardinal(P .polynomialCardinal)))
@@ -154,7 +153,7 @@ object Mermaid:
154
153
Render .mermaidCodeFence(Render .title(P .polynomialGeneric(labelS), 3 , Q .polynomialGeneric((labelA, labelB)), 3 ))
155
154
case Specific =>
156
155
Render .mermaidCodeFence(Render .title(P .polynomialSpecific, 3 , Q .polynomialSpecific, 3 ))
157
- def showTitleCustom (labels : (String , String )): String =
156
+ def showTitleCustom [ Y ] (labels : (String , String )): String =
158
157
Render .mermaidCodeFence(Render .title(labels._1, 3 , labels._2, 3 ))
159
158
def showTitleHtml (titleFmt : Format ): String =
160
159
titleFmt match
@@ -164,7 +163,7 @@ object Mermaid:
164
163
Render .polyMap(P .graphPGeneric(P .polynomialGeneric(labelS), labelS), Q .graphQGeneric((labelA, labelB))(P .graphPGeneric(P .polynomialGeneric(labelS), labelS)))
165
164
case Specific =>
166
165
Render .polyMap(P .graphPSpecific(P .polynomialSpecific), Q .graphQSpecific(P .graphPSpecific(P .polynomialSpecific)))
167
- def showTitleHtmlCustom (labels : (String , String )): String =
166
+ def showTitleHtmlCustom [ Y ] (labels : (String , String )): String =
168
167
Render .polyMap(labels._1, labels._2)
169
168
def showTitledGraph (titleFmt : Format , graphFmt : Format ): String =
170
169
(titleFmt, graphFmt) match
@@ -195,7 +194,7 @@ object Mermaid:
195
194
case (Specific , Specific ) =>
196
195
Render .mermaidCodeFence(Q .graphQSpecific(P .graphPSpecific(P .polynomialSpecific)))
197
196
.addTitle(P .polynomialSpecific, 3 , Q .polynomialSpecific, 3 )
198
- def showTitledGraphCustom (graphFmt : Format , labels : (String , String )): String =
197
+ def showTitledGraphCustom [ Y ] (graphFmt : Format , labels : (String , String )): String =
199
198
graphFmt match
200
199
case Cardinal =>
201
200
Render .mermaidCodeFence(Q .graphQCardinal(P .graphPCardinal(P .polynomialCardinal)))
@@ -224,7 +223,7 @@ object Mermaid:
224
223
Render .mermaidCodeFence(Q .graphQGeneric((labelA2, labelB2))(P .graphPGeneric(P .polynomialGeneric((labelA1, labelB1)), (labelA1, labelB1))))
225
224
case Specific =>
226
225
Render .mermaidCodeFence(Q .graphQSpecific(P .graphPSpecific(P .polynomialSpecific)))
227
- def showGraphCustom (graphFmt : Format , labels : (String , String )): String =
226
+ def showGraphCustom [ Y ] (graphFmt : Format , labels : (String , String )): String =
228
227
graphFmt match
229
228
case Cardinal =>
230
229
Render .mermaidCodeFence(Q .graphQCardinal(P .graphPCardinal(P .polynomialCardinal)))
@@ -240,7 +239,7 @@ object Mermaid:
240
239
Render .mermaidCodeFence(Render .title(P .polynomialGeneric((labelA1, labelB1)), 4 , Q .polynomialGeneric((labelA2, labelB2)), 4 ))
241
240
case Specific =>
242
241
Render .mermaidCodeFence(Render .title(P .polynomialSpecific, 4 , Q .polynomialSpecific, 4 ))
243
- def showTitleCustom (labels : (String , String )): String =
242
+ def showTitleCustom [ Y ] (labels : (String , String )): String =
244
243
Render .mermaidCodeFence(Render .title(labels._1, 4 , labels._2, 4 ))
245
244
def showTitleHtml (titleFmt : Format ): String =
246
245
titleFmt match
@@ -250,7 +249,7 @@ object Mermaid:
250
249
Render .polyMap(P .graphPGeneric(P .polynomialGeneric((labelA1, labelB1)), (labelA1, labelB1)), Q .graphQGeneric((labelA2, labelB2))(P .graphPGeneric(P .polynomialGeneric((labelA1, labelB1)), (labelA1, labelB1))))
251
250
case Specific =>
252
251
Render .polyMap(P .graphPSpecific(P .polynomialSpecific), Q .graphQSpecific(P .graphPSpecific(P .polynomialSpecific)))
253
- def showTitleHtmlCustom (labels : (String , String )): String =
252
+ def showTitleHtmlCustom [ Y ] (labels : (String , String )): String =
254
253
Render .polyMap(labels._1, labels._2)
255
254
def showTitledGraph (titleFmt : Format , graphFmt : Format ): String =
256
255
(titleFmt, graphFmt) match
@@ -281,7 +280,7 @@ object Mermaid:
281
280
case (Specific , Specific ) =>
282
281
Render .mermaidCodeFence(Q .graphQSpecific(P .graphPSpecific(P .polynomialSpecific)))
283
282
.addTitle(P .polynomialSpecific, 4 , Q .polynomialSpecific, 4 )
284
- def showTitledGraphCustom (graphFmt : Format , labels : (String , String )): String =
283
+ def showTitledGraphCustom [ Y ] (graphFmt : Format , labels : (String , String )): String =
285
284
graphFmt match
286
285
case Cardinal =>
287
286
Render .mermaidCodeFence(Q .graphQCardinal(P .graphPCardinal(P .polynomialCardinal)))
@@ -311,7 +310,7 @@ object Mermaid:
311
310
Render .mermaidCodeFence(Q .graphQGeneric(((labelA1, labelB1), (labelA2, labelB2)))(P .graphPGeneric(P .polynomialGeneric(labelS), labelS)))
312
311
case Specific =>
313
312
Render .mermaidCodeFence(Q .graphQSpecific(P .graphPSpecific(P .polynomialSpecific)))
314
- def showGraphCustom (graphFmt : Format , labels : (String , String )): String =
313
+ def showGraphCustom [ Y ] (graphFmt : Format , labels : (String , String )): String =
315
314
graphFmt match
316
315
case Cardinal =>
317
316
Render .mermaidCodeFence(Q .graphQCardinal(P .graphPCardinal(P .polynomialCardinal)))
@@ -327,7 +326,7 @@ object Mermaid:
327
326
Render .mermaidCodeFence(Render .title(P .polynomialGeneric(labelS), 3 , Q .polynomialGeneric(((labelA1, labelB1), (labelA2, labelB2))), 3 ))
328
327
case Specific =>
329
328
Render .mermaidCodeFence(Render .title(P .polynomialSpecific, 3 , Q .polynomialSpecific, 3 ))
330
- def showTitleCustom (labels : (String , String )): String =
329
+ def showTitleCustom [ Y ] (labels : (String , String )): String =
331
330
Render .mermaidCodeFence(Render .title(labels._1, 3 , labels._2, 3 ))
332
331
def showTitleHtml (titleFmt : Format ): String =
333
332
titleFmt match
@@ -337,7 +336,7 @@ object Mermaid:
337
336
Render .polyMap(P .graphPGeneric(P .polynomialGeneric(labelS), labelS), Q .graphQGeneric(((labelA1, labelB1), (labelA2, labelB2)))(P .graphPGeneric(P .polynomialGeneric(labelS), labelS)))
338
337
case Specific =>
339
338
Render .polyMap(P .graphPSpecific(P .polynomialSpecific), Q .graphQSpecific(P .graphPSpecific(P .polynomialSpecific)))
340
- def showTitleHtmlCustom (labels : (String , String )): String =
339
+ def showTitleHtmlCustom [ Y ] (labels : (String , String )): String =
341
340
Render .polyMap(labels._1, labels._2)
342
341
def showTitledGraph (titleFmt : Format , graphFmt : Format ): String =
343
342
(titleFmt, graphFmt) match
@@ -368,7 +367,7 @@ object Mermaid:
368
367
case (Specific , Specific ) =>
369
368
Render .mermaidCodeFence(Q .graphQSpecific(P .graphPSpecific(P .polynomialSpecific)))
370
369
.addTitle(P .polynomialSpecific, 3 , Q .polynomialSpecific, 3 )
371
- def showTitledGraphCustom (graphFmt : Format , labels : (String , String )): String =
370
+ def showTitledGraphCustom [ Y ] (graphFmt : Format , labels : (String , String )): String =
372
371
graphFmt match
373
372
case Cardinal =>
374
373
Render .mermaidCodeFence(Q .graphQCardinal(P .graphPCardinal(P .polynomialCardinal)))
0 commit comments