Skip to content

Commit fa2a4db

Browse files
authored
refactor: use visible types application PS feature (#40)
1 parent 3b2292e commit fa2a4db

File tree

25 files changed

+348
-467
lines changed

25 files changed

+348
-467
lines changed

lib/purescript-computation/src/purs/Computation.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ instance (Document a) ⇒ Document (ValueSample a) where
6060
( M.paragraph
6161
$ ArrayNE.singleton
6262
$ M.text
63-
$ description <> StringNE.nes (Proxy Proxy ":")
63+
$ description <> StringNE.nes (Proxy @":")
6464
)
6565
:| [ M.blockquote $ document sample ]
6666

lib/purescript-computation/src/purs/Computation/Utils.purs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ documentInput = hfoldl
132132
$ M.emphasis
133133
$ ArrayNE.singleton
134134
$ M.text
135-
$ StringNE.nes (Proxy Proxy "Input:")
135+
$ StringNE.nes (Proxy @"Input:")
136136
)
137137

138138
documentOutput
@@ -149,15 +149,15 @@ documentOutput outputSample =
149149
$ M.emphasis
150150
$ ArrayNE.singleton
151151
$ M.text
152-
$ StringNE.nes (Proxy Proxy "Output:")
152+
$ StringNE.nes (Proxy @"Output:")
153153
)
154154
<>
155155
( ArrayNE.singleton
156156
$ M.paragraph
157157
$ ArrayNE.singleton
158158
$ M.text
159159
$ mapping GetValueDescription outputSample
160-
<> StringNE.nes (Proxy Proxy ":")
160+
<> StringNE.nes (Proxy @":")
161161
)
162162
<>
163163
( ArrayNE.singleton $ M.blockquote $ document
@@ -216,17 +216,18 @@ documentComputation
216216

217217
renderSchema Array FlowContentNode
218218
renderSchema =
219-
[ M.heading2 $ ArrayNE.singleton $ M.text $ StringNE.nes
220-
(Proxy Proxy "Schema")
219+
[ M.heading2
220+
$ ArrayNE.singleton
221+
$ M.text
222+
$ StringNE.nes (Proxy @"Schema")
221223
] <> (ArrayNE.toArray $ documentSchema input output)
222224

223225
renderContext Array FlowContentNode
224226
renderContext =
225227
[ M.heading2
226228
$ ArrayNE.singleton
227229
$ M.text
228-
$ StringNE.nes
229-
(Proxy Proxy "Context")
230+
$ StringNE.nes (Proxy @"Context")
230231
] <> context
231232

232233
renderExamples
@@ -238,8 +239,7 @@ documentComputation
238239
[ M.heading2
239240
$ ArrayNE.singleton
240241
$ M.text
241-
$ StringNE.nes
242-
(Proxy Proxy "Examples")
242+
$ StringNE.nes (Proxy @"Examples")
243243
]
244244
<> (renderExamplesIndex $ Tuple.fst <$> docsByIdx)
245245
<>
@@ -256,8 +256,7 @@ documentComputation
256256
[ M.heading2
257257
$ ArrayNE.singleton
258258
$ M.text
259-
$ StringNE.nes
260-
(Proxy Proxy "Properties")
259+
$ StringNE.nes (Proxy @"Properties")
261260
, M.unorderedList $ documentComputationProperty <$> props
262261
]
263262
Nothing

lib/purescript-computation/test/purs/Test/Snapshot/Spec/Docs.purs

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type OutputSample = ValueSample Output
3131
spec SnapshotTestSpec Spec
3232
spec =
3333
{ describeInput
34-
, description: StringNE.nes (Proxy Proxy "abc")
34+
, description: StringNE.nes (Proxy @"rendering computation spec")
3535
, executeCommand: pure <<< renderComputationSpec
3636
, fixtures
3737
, initHook: Nothing
@@ -41,7 +41,7 @@ fixtures ∷ Array (Fixture Spec)
4141
fixtures =
4242
renderFixture <$>
4343
[ { computationSpec: computation1
44-
, outputFile: StringNE.nes (Proxy Proxy "computation1.md")
44+
, outputFile: StringNE.nes (Proxy @"computation1.md")
4545
}
4646
]
4747

@@ -52,7 +52,7 @@ renderFixture { computationSpec, outputFile } =
5252
{ input: computationSpec, outputPath }
5353
where
5454
outputPath NonEmptyString
55-
outputPath = StringNE.nes (Proxy Proxy "markdown/") <> outputFile
55+
outputPath = StringNE.nes (Proxy @"markdown/") <> outputFile
5656

5757
describeInput Spec String
5858
describeInput { input, output } = "a computation with input of '"
@@ -72,58 +72,57 @@ computation1 =
7272
[ M.paragraph
7373
$ ArrayNE.singleton
7474
$ M.text
75-
$ StringNE.nes
76-
(Proxy Proxy "computation context")
75+
$ StringNE.nes (Proxy @"computation context")
7776
]
7877
, description: \oSpec { i: iSpec, s: sSpec } →
79-
StringNE.nes (Proxy Proxy "computation of ")
78+
StringNE.nes (Proxy @"computation of ")
8079
<> show1 oSpec
81-
<> StringNE.nes (Proxy Proxy " based on ")
80+
<> StringNE.nes (Proxy @" based on ")
8281
<> show1 iSpec
83-
<> StringNE.nes (Proxy Proxy " and ")
82+
<> StringNE.nes (Proxy @" and ")
8483
<> show1 sSpec
8584
, input:
8685
{ i: ValueSpec
8786
$
88-
StringNE.nes (Proxy Proxy "integers")
87+
StringNE.nes (Proxy @"integers")
8988
, s: ValueSpec
90-
$ StringNE.nes (Proxy Proxy "a string")
89+
$ StringNE.nes (Proxy @"a string")
9190
}
9291
, examples:
9392
[ { description: StringNE.nes
94-
(Proxy Proxy "example1 description")
93+
(Proxy @"example1 description")
9594
, expectedOutput: ValueSample
96-
{ description: StringNE.nes (Proxy Proxy "false value")
95+
{ description: StringNE.nes (Proxy @"false value")
9796
, sample: false
9897
}
9998
, input:
10099
{ i: ValueSample
101100
{ description: StringNE.nes
102-
(Proxy Proxy "number one and two")
101+
(Proxy @"number one and two")
103102
, sample: [ 1, 2 ]
104103
}
105104
, s: ValueSample
106105
{ description: StringNE.nes
107-
(Proxy Proxy "a three letter word")
106+
(Proxy @"a three letter word")
108107
, sample: "fox"
109108
}
110109
}
111110
}
112111
, { description: StringNE.nes
113-
(Proxy Proxy "example2 description")
112+
(Proxy @"example2 description")
114113
, expectedOutput: ValueSample
115-
{ description: StringNE.nes (Proxy Proxy "true value")
114+
{ description: StringNE.nes (Proxy @"true value")
116115
, sample: true
117116
}
118117
, input:
119118
{ i: ValueSample
120119
{ description: StringNE.nes
121-
(Proxy Proxy "number two, three and four")
120+
(Proxy @"number two, three and four")
122121
, sample: [ 2, 3, 4 ]
123122
}
124123
, s: ValueSample
125124
{ description: StringNE.nes
126-
(Proxy Proxy "a three letter word")
125+
(Proxy @"a three letter word")
127126
, sample: "fox"
128127
}
129128
}
@@ -135,14 +134,14 @@ computation1 =
135134
} →
136135
String.length s == Array.length i
137136
, output: ValueSpec $ StringNE.nes
138-
(Proxy Proxy "some result")
137+
(Proxy @"some result")
139138
, properties:
140139
[ { description: StringNE.nes
141-
(Proxy Proxy "property1 description")
140+
(Proxy @"property1 description")
142141
, property: const $ pure Success
143142
}
144143
, { description: StringNE.nes
145-
(Proxy Proxy "property2 description")
144+
(Proxy @"property2 description")
146145
, property: const $ pure Success
147146
}
148147
]

lib/purescript-docs-sandbox/src/purs/Sandbox/Component.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ render formComponent { programOutput } =
9999
[ HH.div_
100100
[ HH.text "Options Form:" ]
101101
, HH.slot
102-
(Proxy Proxy "optionsForm")
102+
(Proxy @"optionsForm")
103103
unit
104104
formComponent
105105
unit
@@ -148,7 +148,7 @@ handleAction = case _ of
148148

149149
RunProgramdo
150150
programOutput ← H.request
151-
(Proxy Proxy "optionsForm")
151+
(Proxy @"optionsForm")
152152
unit
153153
RequestProgramExecution
154154
put { programOutput }

lib/purescript-docs/src/purs/Docs/Document.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ instance (Document a, Document e) ⇒ Document (e \/ a) where
2828
document = case _ of
2929
Left error →
3030
( M.paragraph $ ArrayNE.singleton $ M.text $ StringNE.nes
31-
(Proxy Proxy "an error:")
31+
(Proxy @"an error:")
3232
)
3333
:| (Array.fromFoldable $ document error)
3434
Right value →
@@ -52,7 +52,7 @@ documentFoldable isOrdered = NE.singleton
5252
( M.paragraph
5353
$ ArrayNE.singleton
5454
$ M.text
55-
$ StringNE.nes (Proxy Proxy "")
55+
$ StringNE.nes (Proxy @"")
5656
)
5757
( (if isOrdered then M.orderedList else M.unorderedList)
5858
<<< map (ArrayNE.fromNonEmpty <<< document)

lib/purescript-json-schema-cli/src/purs/CLI/Halogen/Component.purs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ handleQuery = case _ of
6969
Sandbox.RequestProgramExecution reply → do
7070
state ← get
7171
outputFormat ← H.request
72-
(Proxy Proxy "outputFormat")
72+
(Proxy @"outputFormat")
7373
unit
7474
OutputFormat.GetOutputFormat
7575
case outputFormat of
@@ -79,7 +79,7 @@ handleQuery = case _ of
7979
case state.selectedCommand of
8080
CompatCommanddo
8181
input ← H.request
82-
(Proxy Proxy "compatOptions")
82+
(Proxy @"compatOptions")
8383
unit
8484
Command.GetInput
8585

@@ -94,7 +94,7 @@ handleQuery = case _ of
9494

9595
DiffCommanddo
9696
input ← H.request
97-
(Proxy Proxy "diffOptions")
97+
(Proxy @"diffOptions")
9898
unit
9999
Command.GetInput
100100

@@ -109,7 +109,7 @@ handleQuery = case _ of
109109

110110
ValidateCommanddo
111111
input ← H.request
112-
(Proxy Proxy "validateOptions")
112+
(Proxy @"validateOptions")
113113
unit
114114
Command.GetInput
115115

@@ -126,7 +126,7 @@ render ∷ ∀ m. State → ComponentHTML Action Slots m
126126
render { selectedCommand } = HH.form_
127127
[ renderCommandSelectionDropdown
128128
, HH.slot_
129-
(Proxy Proxy "outputFormat")
129+
(Proxy @"outputFormat")
130130
unit
131131
OutputFormat.component
132132
unit
@@ -139,19 +139,19 @@ render { selectedCommand } = HH.form_
139139
, case selectedCommand of
140140
CompatCommand
141141
HH.slot_
142-
(Proxy Proxy "compatOptions")
142+
(Proxy @"compatOptions")
143143
unit
144144
CompatOptions.component
145145
unit
146146
DiffCommand
147147
HH.slot_
148-
(Proxy Proxy "diffOptions")
148+
(Proxy @"diffOptions")
149149
unit
150150
DiffOptions.component
151151
unit
152152
ValidateCommand
153153
HH.slot_
154-
(Proxy Proxy "validateOptions")
154+
(Proxy @"validateOptions")
155155
unit
156156
ValidateOptions.component
157157
unit

0 commit comments

Comments
 (0)