narc-0.1: Query SQL databases using Nested Relational Calculus embedded in Haskell.




data Term' a Source

Terms in the nested relational calculus (represented concretely | with named variables)


Bool Bool 
Num Integer 
String String 
PrimApp String [Term a] 
Var Var 
Abs Var (Term a) 
App (Term a) (Term a) 
Table Tabname [(Field, Type)] 
If (Term a) (Term a) (Term a) 
Singleton (Term a) 
Union (Term a) (Term a) 
Record [(String, Term a)] 
Project (Term a) String 
Comp Var (Term a) (Term a) 


Eq a => Eq (Term' a) 
Show a => Show (Term' a) 
Pretty (Term a) 
Pretty (Term' a) 
NarcSem (Term' (), ()) 

type Term a = (Term' a, a)Source

Terms whose every subexpression is annotated with a value of some | particular type.

fvs :: (Term' t, t) -> [Var]Source

substTerm :: Var -> Term t -> Term t -> Term tSource

substTerm x v m: substite v for x in term m (Actually incorrect because it does not make substitutions in the q.)

strip :: Term a -> Term ()Source

retagulate :: (Term a -> a) -> Term a -> Term aSource

rename :: Var -> Var -> (Term' a, a) -> (Term' a, a)Source

(!) :: t -> (t, ())Source

unit_ :: (Term' a, ())Source

class Const a whereSource


cnst_ :: a -> Term ()Source


primApp_ :: String -> [Term a] -> (Term' a, ())Source

var_ :: Var -> (Term' a, ())Source

abs_ :: Var -> Term a -> (Term' a, ())Source

app_ :: Term a -> Term a -> (Term' a, ())Source

table_ :: Tabname -> [(Field, Type)] -> (Term' a, ())Source

ifthenelse_ :: Term a -> Term a -> Term a -> (Term' a, ())Source

singleton_ :: Term a -> (Term' a, ())Source

nil_ :: (Term' a, ())Source

union_ :: Term a -> Term a -> (Term' a, ())Source

record_ :: [(String, Term a)] -> (Term' a, ())Source

project_ :: Term a -> String -> (Term' a, ())Source

foreach_ :: Term a -> Var -> Term a -> (Term' a, ())Source