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

Commit de682fe

Browse files
committed
Rename "vari" to "var"
1 parent 3b26f41 commit de682fe

File tree

6 files changed

+41
-41
lines changed

6 files changed

+41
-41
lines changed

src/SqlSquared.purs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ import Data.Functor.Mu (Mu)
2222
import Data.Json.Extended as EJ
2323
import Data.Traversable (traverse)
2424
import Matryoshka (cata, anaM)
25-
import SqlSquared.Constructors (array, as, binop, bool, buildSelect, groupBy, having, hugeNum, ident, int, invokeFunction, let_, map_, match, null, num, parens, projection, select, set, splice, string, switch, then_, unop, vari, when) as Constructors
26-
import SqlSquared.Lenses (_ArrayLiteral, _Binop, _BoolLiteral, _Case, _DecimalLiteral, _ExprRelation, _GroupBy, _Identifier, _IntLiteral, _InvokeFunction, _JoinRelation, _Let, _Literal, _MapLiteral, _Match, _NullLiteral, _OrderBy, _Parens, _Projection, _Select, _SetLiteral, _Splice, _StringLiteral, _Switch, _TableRelation, _Unop, _Vari, _VariRelation, _alias, _aliasName, _args, _bindTo, _cases, _clause, _cond, _else, _expr, _filter, _groupBy, _having, _ident, _in, _isDistinct, _joinType, _keys, _left, _lhs, _name, _op, _orderBy, _projections, _relations, _rhs, _right, _tablePath) as Lenses
25+
import SqlSquared.Constructors (array, as, binop, bool, buildSelect, groupBy, having, hugeNum, ident, int, invokeFunction, let_, map_, match, null, num, parens, projection, select, set, splice, string, switch, then_, unop, var, when) as Constructors
26+
import SqlSquared.Lenses (_ArrayLiteral, _Binop, _BoolLiteral, _Case, _DecimalLiteral, _ExprRelation, _GroupBy, _Identifier, _IntLiteral, _InvokeFunction, _JoinRelation, _Let, _Literal, _MapLiteral, _Match, _NullLiteral, _OrderBy, _Parens, _Projection, _Select, _SetLiteral, _Splice, _StringLiteral, _Switch, _TableRelation, _Unop, _Var, _VarRelation, _alias, _aliasName, _args, _bindTo, _cases, _clause, _cond, _else, _expr, _filter, _groupBy, _having, _ident, _in, _isDistinct, _joinType, _keys, _left, _lhs, _name, _op, _orderBy, _projections, _relations, _rhs, _right, _tablePath) as Lenses
2727
import SqlSquared.Parser (Literal(..), PositionedToken, parse, parseModule, parseQuery, prettyParse) as Parser
28-
import SqlSquared.Signature (type (×), BinaryOperator(..), BinopR, Case(..), ExprRelR, FunctionDeclR, GroupBy(..), Ident(..), InvokeFunctionR, JoinRelR, JoinType(..), LetR, MatchR, OrderBy(..), OrderType(..), Projection(..), Relation(..), SelectR, SqlDeclF(..), SqlF(..), SqlModuleF(..), SqlQueryF(..), SwitchR, TableRelR, UnaryOperator(..), UnopR, VariRelR, binopFromString, binopToString, genBinaryOperator, genCase, genGroupBy, genJoinType, genOrderBy, genOrderType, genProjection, genRelation, genSqlDeclF, genSqlF, genSqlModuleF, genSqlQueryF, genUnaryOperator, joinTypeFromString, orderTypeFromString, printBinaryOperator, printCase, printGroupBy, printIdent, printJoinType, printOrderBy, printOrderType, printProjection, printRelation, printSqlDeclF, printSqlF, printSqlModuleF, printSqlQueryF, printUnaryOperator, unopFromString, unopToString, (×), (∘), (⋙)) as Sig
28+
import SqlSquared.Signature (type (×), BinaryOperator(..), BinopR, Case(..), ExprRelR, FunctionDeclR, GroupBy(..), Ident(..), InvokeFunctionR, JoinRelR, JoinType(..), LetR, MatchR, OrderBy(..), OrderType(..), Projection(..), Relation(..), SelectR, SqlDeclF(..), SqlF(..), SqlModuleF(..), SqlQueryF(..), SwitchR, TableRelR, UnaryOperator(..), UnopR, VarRelR, binopFromString, binopToString, genBinaryOperator, genCase, genGroupBy, genJoinType, genOrderBy, genOrderType, genProjection, genRelation, genSqlDeclF, genSqlF, genSqlModuleF, genSqlQueryF, genUnaryOperator, joinTypeFromString, orderTypeFromString, printBinaryOperator, printCase, printGroupBy, printIdent, printJoinType, printOrderBy, printOrderType, printProjection, printRelation, printSqlDeclF, printSqlF, printSqlModuleF, printSqlQueryF, printUnaryOperator, unopFromString, unopToString, (×), (∘), (⋙)) as Sig
2929

3030
type Sql = Mu (Sig.SqlF EJ.EJsonF)
3131

src/SqlSquared/Constructors.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import Matryoshka (class Corecursive, embed)
1414
import SqlSquared.Signature as Sig
1515
import SqlSquared.Utils ((∘))
1616

17-
vari t f. Corecursive t (Sig.SqlF f) Sig.Ident t
18-
vari = embed ∘ Sig.Vari
17+
var t f. Corecursive t (Sig.SqlF f) Sig.Ident t
18+
var = embed ∘ Sig.Var
1919

2020
bool t. Corecursive t (Sig.SqlF EJsonF) Boolean t
2121
bool = embed ∘ Sig.LiteralBoolean

src/SqlSquared/Lenses.purs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ _ExprRelation = prism' S.ExprRelation case _ of
3636
S.ExprRelation r → M.Just r
3737
_ → M.Nothing
3838

39-
_VariRelation a. Prism' (S.Relation a) S.VariRelR
40-
_VariRelation = prism' S.VariRelation case _ of
41-
S.VariRelation r → M.Just r
39+
_VarRelation a. Prism' (S.Relation a) S.VarRelR
40+
_VarRelation = prism' S.VarRelation case _ of
41+
S.VarRelation r → M.Just r
4242
_ → M.Nothing
4343

4444
_TableRelation a. Prism' (S.Relation a) S.TableRelR
@@ -281,13 +281,13 @@ _BoolLiteral = prism' (embed ∘ S.Literal ∘ EJ.Boolean) $ project ⋙ case _
281281
S.Literal (EJ.Boolean b) → M.Just b
282282
_ → M.Nothing
283283

284-
_Vari
284+
_Var
285285
t f
286286
. Recursive t (S.SqlF f)
287287
Corecursive t (S.SqlF f)
288288
Prism' t S.Ident
289-
_Vari = prism' (embed ∘ S.Vari) $ project ⋙ case _ of
290-
S.Vari r → M.Just r
289+
_Var = prism' (embed ∘ S.Var) $ project ⋙ case _ of
290+
S.Var r → M.Just r
291291
_ → M.Nothing
292292

293293
_Select

src/SqlSquared/Parser.purs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ primaryExpr = asErrorMessage "primary expression" $ PC.choice
306306
xs → embed $ Sig.SetLiteral xs
307307
, unaryOperator
308308
, functionExpr
309-
, variable
309+
, varable
310310
, literal
311311
, wildcard
312312
, arrayLiteral
@@ -397,7 +397,7 @@ functionDecl parseExpr = asErrorMessage "function declaration" do
397397
_ ← PC.try $ keyword "create" *> keyword "function"
398398
name ← ident
399399
operator "("
400-
args ← PC.sepBy variableString $ operator ","
400+
args ← PC.sepBy varableString $ operator ","
401401
operator ")"
402402
_ ← keyword "begin"
403403
body ← parseExpr
@@ -414,11 +414,11 @@ import_ = asErrorMessage "import declaration" do
414414
path ← Pt.parseAnyDirPath P.fail s
415415
pure $ Sig.Import path
416416

417-
variable m t. SqlParser' m t
418-
variable = C.vari <$> variableString
417+
varable m t. SqlParser' m t
418+
varable = C.var <$> varableString
419419

420-
variableString m. Monad m P.ParserT TokenStream m Ident
421-
variableString = asErrorMessage "variable" $ PC.try do
420+
varableString m. Monad m P.ParserT TokenStream m Ident
421+
varableString = asErrorMessage "varable" $ PC.try do
422422
operator ":"
423423
PP.Position pos1 ← P.position
424424
s ← ident <|> anyKeyword
@@ -557,7 +557,7 @@ relation = do
557557
simpleRelation m t. SqlParser m t (Sig.Relation t)
558558
simpleRelation =
559559
tableRelation
560-
<|> variRelation
560+
<|> varRelation
561561
<|> PC.try exprRelation
562562
<|> parenRelation
563563

@@ -577,13 +577,13 @@ tableRelation = do
577577
ident
578578
pure $ Sig.TableRelation { alias: Ident <$> a, path }
579579

580-
variRelation m t. SqlParser m t (Sig.Relation t)
581-
variRelation = do
582-
varivariableString
580+
varRelation m t. SqlParser m t (Sig.Relation t)
581+
varRelation = do
582+
varvarableString
583583
a ← PC.optionMaybe do
584584
_ ← keyword "as"
585585
ident
586-
pure $ Sig.VariRelation { alias: Ident <$> a, vari }
586+
pure $ Sig.VarRelation { alias: Ident <$> a, var }
587587

588588
exprRelation m t. SqlParser m t (Sig.Relation t)
589589
exprRelation = do

src/SqlSquared/Signature.purs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ import SqlSquared.Signature.JoinType (JoinType(..), genJoinType, joinTypeFromStr
6161
import SqlSquared.Signature.OrderBy (OrderBy(..), genOrderBy, printOrderBy) as OB
6262
import SqlSquared.Signature.OrderType (OrderType(..), genOrderType, orderTypeFromString, printOrderType) as OT
6363
import SqlSquared.Signature.Projection (Projection(..), genProjection, printProjection) as PR
64-
import SqlSquared.Signature.Relation (ExprRelR, JoinRelR, Relation(..), TableRelR, VariRelR, genRelation, printRelation) as RL
64+
import SqlSquared.Signature.Relation (ExprRelR, JoinRelR, Relation(..), TableRelR, VarRelR, genRelation, printRelation) as RL
6565
import SqlSquared.Signature.UnaryOperator (UnaryOperator(..), genUnaryOperator, printUnaryOperator, unopFromString, unopToString) as UO
6666
import SqlSquared.Utils (type (×), (×), (∘), (⋙))
6767

@@ -124,7 +124,7 @@ data SqlF literal a
124124
| Match (MatchR a)
125125
| Switch (SwitchR a)
126126
| Let (LetR a)
127-
| Vari ID.Ident
127+
| Var ID.Ident
128128
| Select (SelectR a)
129129
| Parens a
130130

@@ -175,7 +175,7 @@ instance foldableSqlF ∷ F.Foldable l ⇒ F.Foldable (SqlF l) where
175175
Match { expr, cases, else_ } → f expr <> F.foldMap (F.foldMap f) cases <> F.foldMap f else_
176176
Switch { cases, else_} → F.foldMap (F.foldMap f) cases <> F.foldMap f else_
177177
Let { bindTo, in_ } → f bindTo <> f in_
178-
Vari _ → mempty
178+
Var _ → mempty
179179
Select { projections, relations, filter, groupBy, orderBy } →
180180
F.foldMap (F.foldMap f) projections
181181
<> F.foldMap (F.foldMap f) relations
@@ -197,7 +197,7 @@ instance foldableSqlF ∷ F.Foldable l ⇒ F.Foldable (SqlF l) where
197197
F.foldl f (F.foldl (F.foldl f) a cases) else_
198198
Let { bindTo, in_} →
199199
f (f a bindTo) in_
200-
Vari _ → a
200+
Var _ → a
201201
Select { projections, relations, filter, groupBy, orderBy } →
202202
F.foldl (F.foldl f)
203203
(F.foldl (F.foldl f)
@@ -224,7 +224,7 @@ instance foldableSqlF ∷ F.Foldable l ⇒ F.Foldable (SqlF l) where
224224
F.foldr f (F.foldr (flip $ F.foldr f) a cases) else_
225225
Let { bindTo, in_ } →
226226
f bindTo $ f in_ a
227-
Vari _ → a
227+
Var _ → a
228228
Select { projections, relations, filter, groupBy, orderBy } →
229229
F.foldr (flip $ F.foldr f)
230230
(F.foldr (flip $ F.foldr f)
@@ -288,7 +288,7 @@ instance traversableSqlF ∷ T.Traversable l ⇒ T.Traversable (SqlF l) where
288288
$ { bindTo: _, in_: _, ident }
289289
<$> f bindTo
290290
<*> f in_
291-
Vari s → pure $ Vari s
291+
Var s → pure $ Var s
292292
Parens p → map Parens $ f p
293293
Select { isDistinct, projections, relations, filter, groupBy, orderBy } →
294294
map Select
@@ -349,7 +349,7 @@ printSqlF printLiteralF = case _ of
349349
<> " END"
350350
Let { ident, bindTo, in_ } →
351351
ID.printIdent ident <> " := " <> bindTo <> "; " <> in_
352-
Vari s →
352+
Var s →
353353
":" <> ID.printIdent s
354354
Select { isDistinct, projections, relations, filter, groupBy, orderBy } →
355355
"SELECT "
@@ -390,7 +390,7 @@ genSqlF genLiteral n
390390
| n < 2 =
391391
Gen.oneOf $ (Literal <$> genLiteral n) :|
392392
[ map Identifier genIdent
393-
, map Vari genIdent
393+
, map Var genIdent
394394
, pure $ Splice Nothing
395395
, pure $ SetLiteral L.Nil
396396
]

src/SqlSquared/Signature/Relation.purs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ type ExprRelR a =
2929
, alias ID.Ident
3030
}
3131

32-
type VariRelR =
33-
{ vari ID.Ident
32+
type VarRelR =
33+
{ var ID.Ident
3434
, alias Maybe ID.Ident
3535
}
3636

@@ -42,7 +42,7 @@ type TableRelR =
4242
data Relation a
4343
= JoinRelation (JoinRelR a)
4444
| ExprRelation (ExprRelR a)
45-
| VariRelation VariRelR
45+
| VarRelation VarRelR
4646
| TableRelation TableRelR
4747

4848
derive instance functorRelationFunctor Relation
@@ -76,16 +76,16 @@ instance traversableRelation ∷ T.Traversable Relation where
7676
ExprRelation { expr, alias } →
7777
(ExprRelation ∘ { expr: _, alias })
7878
<$> f expr
79-
VariRelation v → pure $ VariRelation v
79+
VarRelation v → pure $ VarRelation v
8080
TableRelation i → pure $ TableRelation i
8181
sequence = T.sequenceDefault
8282

8383
printRelation Algebra Relation String
8484
printRelation = case _ of
8585
ExprRelation { expr, alias } →
8686
"(" <> expr <> ") AS " <> ID.printIdent alias
87-
VariRelation { vari, alias } →
88-
":" <> ID.printIdent vari <> F.foldMap (\a → " AS " <> ID.printIdent a) alias
87+
VarRelation { var, alias } →
88+
":" <> ID.printIdent var <> F.foldMap (\a → " AS " <> ID.printIdent a) alias
8989
TableRelation { path, alias } →
9090
"`"
9191
<> either Pt.printAnyDirPath Pt.printAnyFilePath path
@@ -105,19 +105,19 @@ genRelation n =
105105
if n < 1
106106
then
107107
Gen.oneOf $ genTable :|
108-
[ genVari
108+
[ genVar
109109
]
110110
else
111111
Gen.oneOf $ genTable :|
112-
[ genVari
112+
[ genVar
113113
, genJoin
114114
, genExpr
115115
]
116116
where
117-
genVari = do
118-
variID.Ident <$> GenS.genUnicodeString
117+
genVar = do
118+
varID.Ident <$> GenS.genUnicodeString
119119
alias ← map ID.Ident <$> GenC.genMaybe GenS.genUnicodeString
120-
pure $ VariRelation { vari, alias }
120+
pure $ VarRelation { var, alias }
121121
genTable = do
122122
path ← Right <$> Pt.genAnyFilePath
123123
alias ← map ID.Ident <$> GenC.genMaybe GenS.genUnicodeString

0 commit comments

Comments
 (0)