Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit 77e3c58

Browse files
committed
Update for PureScript 0.11, rename to SqlSquared
1 parent aef9ce4 commit 77e3c58

24 files changed

+329
-200
lines changed

bower.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@
1515
"package.json"
1616
],
1717
"dependencies": {
18-
"purescript-prelude": "^2.4.0",
19-
"purescript-matryoshka": "^0.2.0",
20-
"purescript-pathy": "^3.0.2",
21-
"purescript-profunctor": "^2.0.0",
22-
"purescript-profunctor-lenses": "^2.6.0",
23-
"purescript-ejson": "^8.0.0"
18+
"purescript-prelude": "^3.0.0",
19+
"purescript-matryoshka": "^0.3.0",
20+
"purescript-pathy": "^4.0.0",
21+
"purescript-profunctor": "^3.0.0",
22+
"purescript-profunctor-lenses": "^3.2.0",
23+
"purescript-ejson": "^9.0.0"
2424
},
2525
"devDependencies": {
26-
"purescript-argonaut": "^2.0.0",
27-
"purescript-search": "^2.0.0",
28-
"purescript-debug": "^2.0.0",
29-
"purescript-test-unit": "^10.1.0"
26+
"purescript-argonaut": "^3.0.0",
27+
"purescript-search": "^3.0.0",
28+
"purescript-debug": "^3.0.0",
29+
"purescript-test-unit": "^11.0.0"
3030
}
3131
}

package.json

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
{
2-
"name": "purescript-sqlsquare",
3-
"license": "Apache-2.0",
4-
"scripts": {
5-
"build": "pulp build -- --censor-lib --strict --stash",
6-
"test": "pulp test -- --censor-lib --strict --stash"
7-
},
8-
"dependencies": {
9-
"pulp": "^10.0.4",
10-
"purescript": "^0.10.7",
11-
"purescript-psa": "^0.4.0"
12-
}
2+
"private": true,
3+
"scripts": {
4+
"build": "pulp build -- --censor-lib --strict --stash",
5+
"test": "pulp test"
6+
},
7+
"dependencies": {
8+
"pulp": "^11.0.0",
9+
"purescript": "^0.11.4",
10+
"purescript-psa": "^0.5.1"
11+
}
1312
}

src/SqlSquare.purs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module SqlSquare
1+
module SqlSquared
22
( Sql
33
, print
44
, encodeJson
@@ -19,10 +19,10 @@ import Data.Json.Extended as EJ
1919

2020
import Matryoshka (cata, anaM)
2121

22-
import SqlSquare.Signature as Sig
23-
import SqlSquare.Lenses as Lenses
24-
import SqlSquare.Constructors as Constructors
25-
import SqlSquare.Parser as Parser
22+
import SqlSquared.Signature as Sig
23+
import SqlSquared.Lenses as Lenses
24+
import SqlSquared.Constructors as Constructors
25+
import SqlSquared.Parser as Parser
2626

2727
import Test.StrongCheck.Gen as Gen
2828

src/SqlSquare/Constructors.purs

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module SqlSquare.Constructors where
1+
module SqlSquared.Constructors where
22

33
import Prelude
44

@@ -12,50 +12,50 @@ import Data.Maybe (Maybe(..))
1212

1313
import Matryoshka (class Corecursive, embed)
1414

15-
import SqlSquare.Signature as Sig
16-
import SqlSquare.Utils ((∘))
15+
import SqlSquared.Signature as Sig
16+
import SqlSquared.Utils ((∘))
1717

1818
vari t f. Corecursive t (Sig.SqlF f) String t
19-
vari s = embed $ Sig.Vari s
19+
vari = embed Sig.Vari
2020

2121
bool t. Corecursive t (Sig.SqlF EJsonF) Boolean t
22-
bool b = embed $ Sig.Literal $ Boolean b
22+
bool = embed Sig.Literal Boolean
2323

2424
null t. Corecursive t (Sig.SqlF EJsonF) t
2525
null = embed $ Sig.Literal Null
2626

2727
int t. Corecursive t (Sig.SqlF EJsonF) Int t
28-
int i = embed $ Sig.Literal $ Integer i
28+
int = embed Sig.Literal Integer
2929

3030
num t. Corecursive t (Sig.SqlF EJsonF) Number t
31-
num i = embed $ Sig.Literal $ Decimal $ HN.fromNumber i
31+
num = embed Sig.Literal Decimal HN.fromNumber
3232

3333
hugeNum t. Corecursive t (Sig.SqlF EJsonF) HN.HugeNum t
34-
hugeNum hn = embed $ Sig.Literal $ Decimal hn
34+
hugeNum = embed Sig.Literal Decimal
3535

3636
string t. Corecursive t (Sig.SqlF EJsonF) String t
37-
string s = embed $ Sig.Literal $ String s
37+
string = embed Sig.Literal String
3838

3939
unop t f. Corecursive t (Sig.SqlF f) Sig.UnaryOperator t t
4040
unop op expr = embed $ Sig.Unop { op, expr }
4141

4242
binop t f. Corecursive t (Sig.SqlF f) Sig.BinaryOperator t t t
4343
binop op lhs rhs = embed $ Sig.Binop { op, lhs, rhs }
4444

45-
set t f g. (Corecursive t (Sig.SqlF g), F.Foldable f) f t t
46-
set l = embed $ Sig.SetLiteral $ L.fromFoldable l
45+
set t f g. Corecursive t (Sig.SqlF g) F.Foldable f f t t
46+
set = embed Sig.SetLiteral L.fromFoldable
4747

48-
array t f. (Corecursive t (Sig.SqlF EJsonF), F.Foldable f) f t t
49-
array l = embed $ Sig.Literal $ Array $ Arr.fromFoldable l
48+
array t f. Corecursive t (Sig.SqlF EJsonF) F.Foldable f f t t
49+
array = embed Sig.Literal Array Arr.fromFoldable
5050

51-
map_ t. (Corecursive t (Sig.SqlF EJsonF), Ord t) Map.Map t t t
52-
map_ m = embed $ Sig.Literal $ MapEJsonMap $ Arr.fromFoldable $ Map.toList m
51+
map_ t. Corecursive t (Sig.SqlF EJsonF) Ord t Map.Map t t t
52+
map_ = embed Sig.Literal MapEJsonMap Map.toUnfoldable
5353

5454
splice t f. Corecursive t (Sig.SqlF f) Maybe t t
55-
splice m = embed $ Sig.Splice m
55+
splice = embed Sig.Splice
5656

5757
ident t f. Corecursive t (Sig.SqlF f) String t
58-
ident i = embed $ Sig.Ident i
58+
ident = embed Sig.Ident
5959

6060
match t f. Corecursive t (Sig.SqlF f) t L.List (Sig.Case t) Maybe t t
6161
match expr cases else_ = embed $ Sig.Match { expr, cases, else_ }
@@ -78,7 +78,8 @@ then_ t f = f t
7878

7979
select
8080
t f
81-
. (Corecursive t (Sig.SqlF EJsonF), F.Foldable f)
81+
. Corecursive t (Sig.SqlF EJsonF)
82+
F.Foldable f
8283
Boolean
8384
f (Sig.Projection t)
8485
Maybe (Sig.Relation t)

src/SqlSquare/Lenses.purs

Lines changed: 43 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module SqlSquare.Lenses where
1+
module SqlSquared.Lenses where
22

33
import Prelude
44

@@ -12,8 +12,8 @@ import Data.NonEmpty as NE
1212

1313
import Matryoshka (class Recursive, class Corecursive, embed, project)
1414

15-
import SqlSquare.Signature as S
16-
import SqlSquare.Utils (type (×), (∘), (⋙))
15+
import SqlSquared.Signature as S
16+
import SqlSquared.Utils (type (×), (∘), (⋙))
1717

1818
_GroupBy a. Iso' (S.GroupBy a) {keys L.List a, having M.Maybe a}
1919
_GroupBy = _Newtype
@@ -131,159 +131,179 @@ _tablePath = lens _.tablePath _{ tablePath = _ }
131131

132132
_SetLiteral
133133
t f
134-
. (Recursive t (S.SqlF f), Corecursive t (S.SqlF f))
134+
. Recursive t (S.SqlF f)
135+
Corecursive t (S.SqlF f)
135136
Prism' t (L.List t)
136137
_SetLiteral = prism' (embed ∘ S.SetLiteral) $ project ⋙ case _ of
137138
S.SetLiteral lst → M.Just lst
138139
_ → M.Nothing
139140

140141
_Literal
141142
t f
142-
. (Recursive t (S.SqlF f), Corecursive t (S.SqlF f))
143+
. Recursive t (S.SqlF f)
144+
Corecursive t (S.SqlF f)
143145
Prism' t (f t)
144146
_Literal = prism' (embed ∘ S.Literal) $ project ⋙ case _ of
145147
S.Literal js → M.Just js
146148
_ → M.Nothing
147149

148150
_ArrayLiteral
149151
t
150-
. (Recursive t (S.SqlF EJ.EJsonF), Corecursive t (S.SqlF EJ.EJsonF))
152+
. Recursive t (S.SqlF EJ.EJsonF)
153+
Corecursive t (S.SqlF EJ.EJsonF)
151154
Prism' t (Array t)
152155
_ArrayLiteral = prism' (embed ∘ S.LiteralEJ.Array) $ project ⋙ case _ of
153156
S.Literal (EJ.Array a) → M.Just a
154157
_ → M.Nothing
155158

156159
_MapLiteral
157160
t
158-
. (Recursive t (S.SqlF EJ.EJsonF), Corecursive t (S.SqlF EJ.EJsonF))
161+
. Recursive t (S.SqlF EJ.EJsonF)
162+
Corecursive t (S.SqlF EJ.EJsonF)
159163
Prism' t (Array (t × t))
160164
_MapLiteral = prism' (embed ∘ S.LiteralEJ.MapEJ.EJsonMap) $ project ⋙ case _ of
161165
S.Literal (EJ.Map (EJ.EJsonMap tpls)) → M.Just tpls
162166
_ → M.Nothing
163167

164168
_Splice
165169
t f
166-
. (Recursive t (S.SqlF f), Corecursive t (S.SqlF f))
170+
. Recursive t (S.SqlF f)
171+
Corecursive t (S.SqlF f)
167172
Prism' t (M.Maybe t)
168173
_Splice = prism' (embed ∘ S.Splice) $ project ⋙ case _ of
169174
S.Splice m → M.Just m
170175
_ → M.Nothing
171176

172177
_Binop
173178
t f
174-
. (Recursive t (S.SqlF f), Corecursive t (S.SqlF f))
179+
. Recursive t (S.SqlF f)
180+
Corecursive t (S.SqlF f)
175181
Prism' t (S.BinopR t)
176182
_Binop = prism' (embed ∘ S.Binop) $ project ⋙ case _ of
177183
S.Binop b → M.Just b
178184
_ → M.Nothing
179185

180186
_Unop
181187
t f
182-
. (Recursive t (S.SqlF f), Corecursive t (S.SqlF f))
188+
. Recursive t (S.SqlF f)
189+
Corecursive t (S.SqlF f)
183190
Prism' t (S.UnopR t)
184191
_Unop = prism' (embed ∘ S.Unop) $ project ⋙ case _ of
185192
S.Unop r → M.Just r
186193
_ → M.Nothing
187194

188195
_Ident
189196
t f
190-
. (Recursive t (S.SqlF f), Corecursive t (S.SqlF f))
197+
. Recursive t (S.SqlF f)
198+
Corecursive t (S.SqlF f)
191199
Prism' t String
192200
_Ident = prism' (embed ∘ S.Ident) $ project ⋙ case _ of
193201
S.Ident s → M.Just s
194202
_ → M.Nothing
195203

196204
_InvokeFunction
197205
t f
198-
. (Recursive t (S.SqlF f), Corecursive t (S.SqlF f))
206+
. Recursive t (S.SqlF f)
207+
Corecursive t (S.SqlF f)
199208
Prism' t (S.InvokeFunctionR t)
200209
_InvokeFunction = prism' (embed ∘ S.InvokeFunction) $ project ⋙ case _ of
201210
S.InvokeFunction r → M.Just r
202211
_ → M.Nothing
203212

204213
_Match
205214
t f
206-
. (Recursive t (S.SqlF f), Corecursive t (S.SqlF f))
215+
. Recursive t (S.SqlF f)
216+
Corecursive t (S.SqlF f)
207217
Prism' t (S.MatchR t)
208218
_Match = prism' (embed ∘ S.Match) $ project ⋙ case _ of
209219
S.Match r → M.Just r
210220
_ → M.Nothing
211221

212222
_Switch
213223
t f
214-
. (Recursive t (S.SqlF f), Corecursive t (S.SqlF f))
224+
. Recursive t (S.SqlF f)
225+
Corecursive t (S.SqlF f)
215226
Prism' t (S.SwitchR t)
216227
_Switch = prism' (embed ∘ S.Switch) $ project ⋙ case _ of
217228
S.Switch r → M.Just r
218229
_ → M.Nothing
219230

220231
_Let
221232
t f
222-
. (Recursive t (S.SqlF f), Corecursive t (S.SqlF f))
233+
. Recursive t (S.SqlF f)
234+
Corecursive t (S.SqlF f)
223235
Prism' t (S.LetR t)
224236
_Let = prism' (embed ∘ S.Let) $ project ⋙ case _ of
225237
S.Let r → M.Just r
226238
_ → M.Nothing
227239

228240
_IntLiteral
229241
t
230-
. (Recursive t (S.SqlF EJ.EJsonF), Corecursive t (S.SqlF EJ.EJsonF))
242+
. Recursive t (S.SqlF EJ.EJsonF)
243+
Corecursive t (S.SqlF EJ.EJsonF)
231244
Prism' t Int
232245
_IntLiteral = prism' (embed ∘ S.LiteralEJ.Integer) $ project ⋙ case _ of
233246
S.Literal (EJ.Integer r) → M.Just r
234247
_ → M.Nothing
235248

236249
_DecimalLiteral
237250
t
238-
. (Recursive t (S.SqlF EJ.EJsonF), Corecursive t (S.SqlF EJ.EJsonF))
251+
. Recursive t (S.SqlF EJ.EJsonF)
252+
Corecursive t (S.SqlF EJ.EJsonF)
239253
Prism' t HN.HugeNum
240254
_DecimalLiteral = prism' (embed ∘ S.LiteralEJ.Decimal) $ project ⋙ case _ of
241255
S.Literal (EJ.Decimal r) → M.Just r
242256
_ → M.Nothing
243257

244258
_StringLiteral
245259
t
246-
. (Recursive t (S.SqlF EJ.EJsonF), Corecursive t (S.SqlF EJ.EJsonF))
260+
. Recursive t (S.SqlF EJ.EJsonF)
261+
Corecursive t (S.SqlF EJ.EJsonF)
247262
Prism' t String
248263
_StringLiteral = prism' (embed ∘ S.LiteralEJ.String) $ project ⋙ case _ of
249264
S.Literal (EJ.String r) → M.Just r
250265
_ → M.Nothing
251266

252267
_NullLiteral
253268
t
254-
. (Recursive t (S.SqlF EJ.EJsonF), Corecursive t (S.SqlF EJ.EJsonF))
269+
. Recursive t (S.SqlF EJ.EJsonF)
270+
Corecursive t (S.SqlF EJ.EJsonF)
255271
Prism' t Unit
256272
_NullLiteral = prism' (const $ embed $ S.Literal EJ.Null) $ project ⋙ case _ of
257273
S.Literal EJ.NullM.Just unit
258274
_ → M.Nothing
259275

260276
_BoolLiteral
261277
t
262-
. (Recursive t (S.SqlF EJ.EJsonF), Corecursive t (S.SqlF EJ.EJsonF))
278+
. Recursive t (S.SqlF EJ.EJsonF)
279+
Corecursive t (S.SqlF EJ.EJsonF)
263280
Prism' t Boolean
264281
_BoolLiteral = prism' (embed ∘ S.LiteralEJ.Boolean) $ project ⋙ case _ of
265282
S.Literal (EJ.Boolean b) → M.Just b
266283
_ → M.Nothing
267284

268285
_Vari
269286
t f
270-
. (Recursive t (S.SqlF f), Corecursive t (S.SqlF f))
287+
. Recursive t (S.SqlF f)
288+
Corecursive t (S.SqlF f)
271289
Prism' t String
272290
_Vari = prism' (embed ∘ S.Vari) $ project ⋙ case _ of
273291
S.Vari r → M.Just r
274292
_ → M.Nothing
275293

276294
_Select
277295
t f
278-
. (Recursive t (S.SqlF f), Corecursive t (S.SqlF f))
296+
. Recursive t (S.SqlF f)
297+
Corecursive t (S.SqlF f)
279298
Prism' t (S.SelectR t)
280299
_Select = prism' (embed ∘ S.Select) $ project ⋙ case _ of
281300
S.Select r → M.Just r
282301
_ → M.Nothing
283302

284303
_Parens
285304
t f
286-
. (Recursive t (S.SqlF f), Corecursive t (S.SqlF f))
305+
. Recursive t (S.SqlF f)
306+
Corecursive t (S.SqlF f)
287307
Prism' t t
288308
_Parens = prism' (embed ∘ S.Parens) $ project ⋙ case _ of
289309
S.Parens t → M.Just t

0 commit comments

Comments
 (0)