@@ -5,6 +5,7 @@ import Prelude
55import Control.Monad.Gen as Gen
66import Control.Monad.Gen.Common as GenC
77import Control.Monad.Rec.Class (class MonadRec )
8+ import Data.Either (Either (..), either )
89import Data.Foldable as F
910import Data.Maybe (Maybe )
1011import Data.NonEmpty ((:|))
@@ -15,6 +16,7 @@ import SqlSquared.Path as Pt
1516import SqlSquared.Signature.Ident as ID
1617import SqlSquared.Signature.JoinType as JT
1718import SqlSquared.Utils ((∘))
19+
1820type JoinRelR a =
1921 { left ∷ Relation a
2022 , right ∷ Relation a
@@ -33,7 +35,7 @@ type VariRelR =
3335 }
3436
3537type TableRelR =
36- { path ∷ Pt.AnyFile
38+ { path ∷ Either Pt.AnyDir Pt.AnyFile
3739 , alias ∷ Maybe String
3840 }
3941
@@ -86,7 +88,7 @@ printRelation = case _ of
8688 " :" <> ID .printIdent vari <> F .foldMap (\a → " AS " <> ID .printIdent a) alias
8789 TableRelation { path, alias } →
8890 " `"
89- <> Pt .printAnyFilePath path
91+ <> either Pt .printAnyDirPath Pt .printAnyFilePath path
9092 <> " `"
9193 <> F .foldMap (\x → " AS " <> ID .printIdent x) alias
9294 JoinRelation { left, right, joinType, clause } →
@@ -117,7 +119,7 @@ genRelation n =
117119 alias ← GenC .genMaybe GenS .genUnicodeString
118120 pure $ VariRelation { vari, alias }
119121 genTable = do
120- path ← Pt .genAnyFilePath
122+ path ← Right <$> Pt .genAnyFilePath
121123 alias ← GenC .genMaybe GenS .genUnicodeString
122124 pure $ TableRelation { path, alias }
123125 genExpr = do
0 commit comments