aboutsummaryrefslogtreecommitdiffstats
path: root/app/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'app/Main.hs')
-rw-r--r--app/Main.hs28
1 files changed, 13 insertions, 15 deletions
diff --git a/app/Main.hs b/app/Main.hs
index c0618ae..4eedc97 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -230,9 +230,9 @@ instance IsString Query where
F.Qualified
<$> (fieldPart <* P.string ".")
<*> (N.map T.pack <$> PN.sepBy1 fieldPart (P.string ".")),
- do
- F.Unqualified
- <$> (N.map T.pack <$> PN.sepBy1 fieldPart (P.string "."))
+ do
+ F.Unqualified
+ <$> (N.map T.pack <$> PN.sepBy1 fieldPart (P.string "."))
]
fieldPart :: P.Parsec Void String String
@@ -273,7 +273,7 @@ query (Select fs c js es w) = do
=<< ls c
)
es
- pure $ map (select fs) $ where_ w $ embed es' $ combine c' js'
+ pure $ map (select fs) $ where_ w $ embed es' $ join c' js'
where
ls c =
filter (not . (isSuffixOf "/"))
@@ -309,18 +309,16 @@ embed es vss = embed' vss es
)
ess
--- TODO rename `join`
-
-- TODO use fold
-combine ::
+join ::
R.Records J.Value ->
JoinClauses (R.Records J.Value) ->
[R.Records J.Value]
-combine vs js = combine' (map (: []) vs) js
+join vs js = join' (map (: []) vs) js
where
- combine' vss [] = vss
- combine' vss (JoinClause JoinLeft js w : jss) =
- combine'
+ join' vss [] = vss
+ join' vss (JoinClause JoinLeft js w : jss) =
+ join'
( concatMap
( \vs -> case filter (satisfies w) $ map (\j -> vs ++ [j]) js of
[] -> [vs]
@@ -329,8 +327,8 @@ combine vs js = combine' (map (: []) vs) js
vss
)
jss
- combine' vss (JoinClause JoinRight js w : jss) =
- combine'
+ join' vss (JoinClause JoinRight js w : jss) =
+ join'
( concatMap
( \j -> case filter (satisfies w) $ map (\vs -> vs ++ [j]) vss of
[] -> [[j]]
@@ -339,8 +337,8 @@ combine vs js = combine' (map (: []) vs) js
js
)
jss
- combine' vss (JoinClause JoinFull js w : jss) =
- combine'
+ join' vss (JoinClause JoinFull js w : jss) =
+ join'
( concatMap
( \vs -> case filter (satisfies w) $ map (\j -> vs ++ [j]) js of
[] -> [vs]