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
Embed
What would you like to do?
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