@@ -3,8 +3,11 @@ module SqlSquared
33 , SqlQuery
44 , SqlModule
55 , print
6+ , printPretty
67 , printQuery
8+ , printQueryPretty
79 , printModule
10+ , printModulePretty
811 , genSql
912 , genSqlQuery
1013 , genSqlModule
@@ -25,7 +28,7 @@ import Matryoshka (cata, anaM)
2528import SqlSquared.Constructors (array , as , as' , binop , bool , buildSelect , groupBy , having , hugeNum , ident , ident' , int , invokeFunction , invokeFunction' , let' , let_ , map_ , match , match' , null , num , parens , projection , select , select' , set , splice , string , switch , switch' , then_ , unop , var , when ) as Constructors
2629import 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
2730import 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 , 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
31+ 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 , printSqlFPretty , printSqlModuleF , printSqlQueryF , printUnaryOperator , unopFromString , unopToString , (×), (∘), (⋙)) as Sig
2932
3033type Sql = Mu (Sig.SqlF EJ.EJsonF )
3134
@@ -42,6 +45,15 @@ printQuery = Sig.printSqlQueryF <<< map print
4245printModule ∷ SqlModule → String
4346printModule = Sig .printSqlModuleF <<< map print
4447
48+ printPretty ∷ Sql → String
49+ printPretty = cata $ Sig .printSqlFPretty EJ .renderEJsonF
50+
51+ printQueryPretty ∷ SqlQuery → String
52+ printQueryPretty = Sig .printSqlQueryF <<< map printPretty
53+
54+ printModulePretty ∷ SqlModule → String
55+ printModulePretty = Sig .printSqlModuleF <<< map printPretty
56+
4557genSql ∷ ∀ m . Gen.MonadGen m ⇒ MonadRec m ⇒ m Sql
4658genSql = Gen .sized $ anaM (Sig .genSqlF EJ .arbitraryEJsonF)
4759
0 commit comments