Skip to content

Instantly share code, notes, and snippets.

@canonic-epicure
Created May 9, 2018 10:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save canonic-epicure/e889a9c955b1c6e2c1973b52ef9a2ce9 to your computer and use it in GitHub Desktop.
module Language
import Control.Monad.State
%default total
%access public export
mutual
record QueryAbstractSyntaxTree where
constructor MkQueryAbstractSyntaxTree
distinct : Bool
data TableJoiningState = NoTables | HasTables
record QueryAstState where
constructor MkQueryAstState
joinState : TableJoiningState
data SqlQueryParts : (result : Type) -> (before : QueryAstState) -> (after : QueryAstState) -> Type where
From :
(source : Bool)
-> SqlQueryParts
()
(MkQueryAstState
NoTables
)
(MkQueryAstState
HasTables
)
collapseToAst : SqlQueryParts a before after -> QueryAbstractSyntaxTree
collapseToAst x =
execState (collapseToAstHelper x) (MkQueryAbstractSyntaxTree False)
where
collapseToAstHelper : SqlQueryParts a before after -> State QueryAbstractSyntaxTree a
collapseToAstHelper (From querySource) = ?aa3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment