| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Traq.ProtoLang.Syntax
Synopsis
- data MetaParam sizeT
- data VarType sizeT
- _Fin :: Traversal' (VarType sizeT) sizeT
- _Arr :: Traversal' (VarType sizeT) (sizeT, VarType sizeT)
- _Tup :: Traversal' (VarType sizeT) [VarType sizeT]
- data Value sizeT
- _FinV :: Traversal' (Value sizeT) sizeT
- _ArrV :: Traversal' (Value sizeT) [Value sizeT]
- _TupV :: Traversal' (Value sizeT) [Value sizeT]
- data FnType size = FnType [VarType size] [VarType size]
- data UnOp = NotOp
- data BinOp
- data NAryOp = MultiOrOp
- data BasicExpr sizeT
- (.<=.) :: BasicExpr sizeT -> BasicExpr sizeT -> BasicExpr sizeT
- notE :: BasicExpr sizeT -> BasicExpr sizeT
- (.+.) :: BasicExpr sizeT -> BasicExpr sizeT -> BasicExpr sizeT
- (.&&.) :: BasicExpr sizeT -> BasicExpr sizeT -> BasicExpr sizeT
- data DistrExpr sizeT
- data Expr ext
- = BasicExprE {
- basic_expr :: BasicExpr (SizeType ext)
- | RandomSampleE {
- distr_expr :: DistrExpr (SizeType ext)
- | FunCallE { }
- | PrimCallE {
- prim :: ext
- | LoopE {
- initial_args :: [Ident]
- loop_body_fun :: Ident
- = BasicExprE {
- data Stmt ext
- data FunBody ext = FunBody {
- param_names, ret_names :: [Ident]
- body_stmt :: Stmt ext
- data FunDef ext = FunDef {}
- data NamedFunDef ext = NamedFunDef {}
- newtype Program ext = Program [NamedFunDef ext]
- type FunCtx ext = Context (FunDef ext)
- namedFunsToFunCtx :: Foldable f => f (NamedFunDef ext) -> FunCtx ext
- programToFunCtx :: Program ext -> FunCtx ext
- funCtxToNamedFuns :: FunCtx ext -> [NamedFunDef ext]
- data Core sizeT precT
- type Core' = Core SizeT Double
- class HasFunCtx p ext | p -> ext where
Syntax
Compile-time constant parameters
Basic Types
Types
Instances
| Functor VarType # | |
| Read sizeT => Read (VarType sizeT) # | |
| Show sizeT => Show (VarType sizeT) # | |
| Eq sizeT => Eq (VarType sizeT) # | |
| HasTypingCtx (TypingCtx sizeT) # | |
Defined in Traq.ProtoLang.TypeCheck | |
| Show a => ToCodeString (VarType a) # | |
Defined in Traq.ProtoLang.Syntax | |
| type SizeType (VarType sizeT) # | |
Defined in Traq.ProtoLang.Syntax | |
_Fin :: Traversal' (VarType sizeT) sizeT #
_Arr :: Traversal' (VarType sizeT) (sizeT, VarType sizeT) #
_Tup :: Traversal' (VarType sizeT) [VarType sizeT] #
Basic Values
Constructors
| FinV sizeT | value of type |
| ArrV [Value sizeT] | value of type |
| TupV [Value sizeT] | tuple value |
Instances
| Functor Value # | |
| Read sizeT => Read (Value sizeT) # | |
| Show sizeT => Show (Value sizeT) # | |
| Eq sizeT => Eq (Value sizeT) # | |
| Ord sizeT => Ord (Value sizeT) # | |
Defined in Traq.ProtoLang.Syntax | |
| HasFunInterpCtx (FunInterpCtx sizeT) # | |
Defined in Traq.ProtoLang.Eval Methods _funInterpCtx :: sizeT0 ~ SizeType (FunInterpCtx sizeT) => Lens' (FunInterpCtx sizeT) (FunInterpCtx sizeT0) # | |
| HasProgramState (ProgramState sizeT) # | |
Defined in Traq.ProtoLang.Eval Methods _state :: sizeT0 ~ SizeType (ProgramState sizeT) => Lens' (ProgramState sizeT) (ProgramState sizeT0) # | |
| Show sizeT => ToCodeString (Value sizeT) # | |
Defined in Traq.ProtoLang.Syntax | |
| type SizeType (FunInterp sizeT) # | |
Defined in Traq.ProtoLang.Eval | |
| type SizeType (Value sizeT) # | |
Defined in Traq.ProtoLang.Syntax | |
_FinV :: Traversal' (Value sizeT) sizeT #
_ArrV :: Traversal' (Value sizeT) [Value sizeT] #
_TupV :: Traversal' (Value sizeT) [Value sizeT] #
Function types
Basic Operations
Unary operations
Constructors
| NotOp |
Binary operations
Operations which take multiple arguments
Constructors
| MultiOrOp |
Basic arithmetic and logical expressions
Constructors
| VarE | |
| ParamE | |
| DefaultE | |
| ConstE | |
| UnOpE | |
| BinOpE | |
| TernaryE | |
| NAryE | |
| IndexE | |
| DynIndexE | |
| UpdateArrE | |
| ProjectE | |
Fields
| |
Instances
| Functor BasicExpr # | |
| IsString (BasicExpr sizeT) # | |
Defined in Traq.ProtoLang.Syntax Methods fromString :: String -> BasicExpr sizeT # | |
| Read sizeT => Read (BasicExpr sizeT) # | |
| Show sizeT => Show (BasicExpr sizeT) # | |
| Eq sizeT => Eq (BasicExpr sizeT) # | |
| HasFreeVars (BasicExpr sizeT) # | |
Defined in Traq.ProtoLang.Vars Methods freeVarsList :: BasicExpr sizeT -> [Ident] # | |
| RenameVars (BasicExpr size) # | |
Defined in Traq.ProtoLang.Vars Methods renameVars :: Ident -> BasicExpr size -> BasicExpr size # | |
| Show sizeT => ToCodeString (BasicExpr sizeT) # | |
Defined in Traq.ProtoLang.Syntax | |
Expressions and Statements
An expression denoting a probablity distribution.
Instances
| Functor DistrExpr # | |
| Read sizeT => Read (DistrExpr sizeT) # | |
| Show sizeT => Show (DistrExpr sizeT) # | |
| Eq sizeT => Eq (DistrExpr sizeT) # | |
| HasFreeVars (DistrExpr sizeT) # | |
Defined in Traq.ProtoLang.Vars Methods freeVarsList :: DistrExpr sizeT -> [Ident] # | |
| Show sizeT => ToCodeString (DistrExpr sizeT) # | |
Defined in Traq.ProtoLang.Syntax | |
| TypingReqs sizeT => TypeInferrable (DistrExpr sizeT) sizeT # | |
Defined in Traq.ProtoLang.TypeCheck Methods inferTypes :: forall ext' m. (m ~ TypeChecker ext', sizeT ~ SizeType ext') => DistrExpr sizeT -> m [VarType sizeT] # | |
| type SizeType (DistrExpr sizeT) # | |
Defined in Traq.ProtoLang.Syntax | |
An expression in the prototype language. It appears as the RHS of an assignment statement.
Constructors
| BasicExprE | |
Fields
| |
| RandomSampleE | |
Fields
| |
| FunCallE | |
| PrimCallE | |
Fields
| |
| LoopE | |
Fields
| |
Instances
| (Read ext, Read (SizeType ext)) => Read (Expr ext) # | |
| (Show ext, Show (SizeType ext)) => Show (Expr ext) # | |
| (Eq ext, Eq (SizeType ext)) => Eq (Expr ext) # | |
| MapSize ext => MapSize (Expr ext) # | |
Defined in Traq.ProtoLang.Lenses Associated Types type MappedSize (Expr ext) size' # | |
| (Parseable ext, SizeType ext ~ SymbSize) => Parseable (Expr ext) # | |
Defined in Traq.ProtoLang.Parser Methods parseE :: TokenParser () -> Parser (Expr ext) # | |
| HasFreeVars ext => HasFreeVars (Expr ext) # | The set of free (unbound) variables in an expression |
Defined in Traq.ProtoLang.Vars Methods freeVarsList :: Expr ext -> [Ident] # | |
| RenameVars ext => RenameVars (Expr ext) # | |
Defined in Traq.ProtoLang.Vars Methods renameVars :: Ident -> Expr ext -> Expr ext # | |
| (Show (SizeType ext), ToCodeString ext) => ToCodeString (Expr ext) # | |
Defined in Traq.ProtoLang.Syntax | |
| TypeInferrable ext sizeT => TypeInferrable (Expr ext) sizeT # | |
Defined in Traq.ProtoLang.TypeCheck Methods inferTypes :: forall ext' m. (m ~ TypeChecker ext', sizeT ~ SizeType ext') => Expr ext -> m [VarType sizeT] # | |
| CostQ ext size prec => CostQ (Expr ext) size prec # | |
Defined in Traq.Analysis.Cost.Quantum Methods costQ :: forall ext' cost m. (m ~ CostAnalysisMonad ext', CostQ ext' size prec, CostModelReqs size prec cost) => Expr ext -> m cost # | |
| ExpCostQ ext size prec => ExpCostQ (Expr ext) size prec # | |
Defined in Traq.Analysis.Cost.Quantum Methods expCostQ :: forall ext' cost m. (m ~ CostAnalysisMonad ext', ExpCostQ ext' size prec, CostModelReqs size prec cost) => Expr ext -> ProgramState size -> m cost # | |
| CostU ext size prec => CostU (Expr ext) size prec # | |
Defined in Traq.Analysis.Cost.Unitary Methods costU :: forall ext' costT m. (m ~ CostAnalysisMonad ext', CostU ext' size prec, CostModelReqs size prec costT) => Expr ext -> m costT # | |
| TVErrorQ ext size prec => TVErrorQ (Expr ext) size prec # | |
| TraceNormErrorU ext size prec => TraceNormErrorU (Expr ext) size prec # | |
Defined in Traq.Analysis.Error.Unitary Methods traceNormErrorU :: forall ext' m. (m ~ ErrorAnalysisMonad ext', TraceNormErrorU ext' size prec, SizeType ext' ~ size, PrecType ext' ~ prec) => Expr ext -> m (FailProb prec) # | |
| Evaluatable ext sizeT precT => Evaluatable (Expr ext) sizeT precT # | |
Defined in Traq.ProtoLang.Eval | |
| type PrecType (Expr ext) # | |
Defined in Traq.ProtoLang.Syntax | |
| type SizeType (Expr ext) # | |
Defined in Traq.ProtoLang.Syntax | |
| type MappedSize (Expr ext) size' # | |
Defined in Traq.ProtoLang.Lenses | |
A statement in the prototype language.
Constructors
| ExprS | |
| IfThenElseS | |
| SeqS [Stmt ext] | |
Instances
| (Read ext, Read (SizeType ext)) => Read (Stmt ext) # | |
| (Show ext, Show (SizeType ext)) => Show (Stmt ext) # | |
| (Eq ext, Eq (SizeType ext)) => Eq (Stmt ext) # | |
| MapSize ext => MapSize (Stmt ext) # | |
Defined in Traq.ProtoLang.Lenses Associated Types type MappedSize (Stmt ext) size' # | |
| (Parseable ext, SizeType ext ~ SymbSize) => Parseable (Stmt ext) # | |
Defined in Traq.ProtoLang.Parser Methods parseE :: TokenParser () -> Parser (Stmt ext) # | |
| HasFreeVars ext => HasFreeVars (Stmt ext) # | The set of free (unbound) variables |
Defined in Traq.ProtoLang.Vars Methods freeVarsList :: Stmt ext -> [Ident] # | |
| RenameVars ext => RenameVars (Stmt ext) # | |
Defined in Traq.ProtoLang.Vars Methods renameVars :: Ident -> Stmt ext -> Stmt ext # | |
| HasAst (Stmt ext) # | |
Defined in Traq.ProtoLang.Syntax Methods _ast :: Traversal' (Stmt ext) (Stmt ext) # | |
| HasStmt (Stmt ext) # | |
Defined in Traq.ProtoLang.Syntax | |
| (Show (SizeType ext), ToCodeString ext) => ToCodeString (Stmt ext) # | |
Defined in Traq.ProtoLang.Syntax | |
| TypeInferrable ext sizeT => TypeInferrable (Stmt ext) sizeT # | |
Defined in Traq.ProtoLang.TypeCheck Methods inferTypes :: forall ext' m. (m ~ TypeChecker ext', sizeT ~ SizeType ext') => Stmt ext -> m [VarType sizeT] # | |
| CostQ ext size prec => CostQ (Stmt ext) size prec # | |
Defined in Traq.Analysis.Cost.Quantum Methods costQ :: forall ext' cost m. (m ~ CostAnalysisMonad ext', CostQ ext' size prec, CostModelReqs size prec cost) => Stmt ext -> m cost # | |
| CostU ext size prec => CostU (Stmt ext) size prec # | |
Defined in Traq.Analysis.Cost.Unitary Methods costU :: forall ext' costT m. (m ~ CostAnalysisMonad ext', CostU ext' size prec, CostModelReqs size prec costT) => Stmt ext -> m costT # | |
| TVErrorQ ext size prec => TVErrorQ (Stmt ext) size prec # | |
| TraceNormErrorU ext size prec => TraceNormErrorU (Stmt ext) size prec # | |
Defined in Traq.Analysis.Error.Unitary Methods traceNormErrorU :: forall ext' m. (m ~ ErrorAnalysisMonad ext', TraceNormErrorU ext' size prec, SizeType ext' ~ size, PrecType ext' ~ prec) => Stmt ext -> m (FailProb prec) # | |
| type PrecType (Stmt ext) # | |
Defined in Traq.ProtoLang.Syntax | |
| type SizeType (Stmt ext) # | |
Defined in Traq.ProtoLang.Syntax | |
| type StmtOf (Stmt ext) # | |
Defined in Traq.ProtoLang.Syntax | |
| type MappedSize (Stmt ext) size' # | |
Defined in Traq.ProtoLang.Lenses | |
The body of a function.
Instances
| (Read ext, Read (SizeType ext)) => Read (FunBody ext) # | |
| (Show ext, Show (SizeType ext)) => Show (FunBody ext) # | |
| (Eq ext, Eq (SizeType ext)) => Eq (FunBody ext) # | |
| MapSize ext => MapSize (FunBody ext) # | |
Defined in Traq.ProtoLang.Lenses Associated Types type MappedSize (FunBody ext) size' # | |
| RenameVars ext => RenameVars (FunBody ext) # | |
Defined in Traq.ProtoLang.Vars Methods renameVars :: Ident -> FunBody ext -> FunBody ext # | |
| HasStmt (FunBody ext) # | |
Defined in Traq.ProtoLang.Syntax | |
| type PrecType (FunBody ext) # | |
Defined in Traq.ProtoLang.Syntax | |
| type SizeType (FunBody ext) # | |
Defined in Traq.ProtoLang.Syntax | |
| type StmtOf (FunBody ext) # | |
Defined in Traq.ProtoLang.Syntax | |
| type MappedSize (FunBody ext) size' # | |
Defined in Traq.ProtoLang.Lenses | |
A function definition or declaration in the prototype language.
Constructors
| FunDef | |
Instances
data NamedFunDef ext #
A function with a name
Constructors
| NamedFunDef | |
Instances
A program is a list of named functions, with the last being the entry point.
Constructors
| Program [NamedFunDef ext] |
Instances
| (Read ext, Read (SizeType ext)) => Read (Program ext) # | |
| (Show ext, Show (SizeType ext)) => Show (Program ext) # | |
| (Eq ext, Eq (SizeType ext)) => Eq (Program ext) # | |
| MapSize ext => MapSize (Program ext) # | |
Defined in Traq.ProtoLang.Lenses Associated Types type MappedSize (Program ext) size' # | |
| RenameVars ext => RenameVars (Program ext) # | |
Defined in Traq.ProtoLang.Vars Methods renameVars :: Ident -> Program ext -> Program ext # | |
| HasStmt (Program ext) # | |
Defined in Traq.ProtoLang.Syntax | |
| (Show (SizeType ext), ToCodeString ext) => ToCodeString (Program ext) # | |
Defined in Traq.ProtoLang.Syntax | |
| type PrecType (Program ext) # | |
Defined in Traq.ProtoLang.Syntax | |
| type SizeType (Program ext) # | |
Defined in Traq.ProtoLang.Syntax | |
| type StmtOf (Program ext) # | |
Defined in Traq.ProtoLang.Syntax | |
| type MappedSize (Program ext) size' # | |
Defined in Traq.ProtoLang.Lenses | |
FunCtx
namedFunsToFunCtx :: Foldable f => f (NamedFunDef ext) -> FunCtx ext #
programToFunCtx :: Program ext -> FunCtx ext #
funCtxToNamedFuns :: FunCtx ext -> [NamedFunDef ext] #
Core
Void extension (i.e. only use the core language)
Usage: p :: Program (Core sizeT precT)
Instances
| Read (Core sizeT precT) # | |
| Show (Core sizeT precT) # | |
| Eq (Core sizeT precT) # | |
| TypingReqs size => CompileQ (Core size prec) # | |
| TypingReqs size => CompileU (Core size prec) # | |
| MapSize (Core size prec) # | |
Defined in Traq.ProtoLang.Lenses Associated Types type MappedSize (Core size prec) size' # | |
| HasFreeVars (Core size prec) # | |
Defined in Traq.ProtoLang.Vars Methods freeVarsList :: Core size prec -> [Ident] # | |
| TypingReqs sizeT => TypeInferrable (Core sizeT precT) sizeT # | |
Defined in Traq.ProtoLang.TypeCheck Methods inferTypes :: forall ext' m. (m ~ TypeChecker ext', sizeT ~ SizeType ext') => Core sizeT precT -> m [VarType sizeT] # | |
| CostReqs size prec => CostQ (Core size prec) size prec # | |
Defined in Traq.Analysis.Cost.Quantum Methods costQ :: forall ext' cost m. (m ~ CostAnalysisMonad ext', CostQ ext' size prec, CostModelReqs size prec cost) => Core size prec -> m cost # | |
| (CostReqs size prec, EvalReqs size prec) => ExpCostQ (Core size prec) size prec # | |
Defined in Traq.Analysis.Cost.Quantum Methods expCostQ :: forall ext' cost m. (m ~ CostAnalysisMonad ext', ExpCostQ ext' size prec, CostModelReqs size prec cost) => Core size prec -> ProgramState size -> m cost # | |
| CostReqs size prec => CostU (Core size prec) size prec # | |
Defined in Traq.Analysis.Cost.Unitary Methods costU :: forall ext' costT m. (m ~ CostAnalysisMonad ext', CostU ext' size prec, CostModelReqs size prec costT) => Core size prec -> m costT # | |
| ErrorReqs size prec => TVErrorQ (Core size prec) size prec # | |
| ErrorReqs size prec => TraceNormErrorU (Core size prec) size prec # | |
Defined in Traq.Analysis.Error.Unitary Methods traceNormErrorU :: forall ext' m. (m ~ ErrorAnalysisMonad ext', TraceNormErrorU ext' size prec, SizeType ext' ~ size, PrecType ext' ~ prec) => Core size prec -> m (FailProb prec) # | |
| EvalReqs SizeT precT => Evaluatable (Core SizeT precT) SizeT precT # | |
| type PrecType (Core size prec) # | |
Defined in Traq.ProtoLang.Syntax | |
| type SizeType (Core size prec) # | |
Defined in Traq.ProtoLang.Syntax | |
| type MappedSize (Core size prec) size' # | |
Defined in Traq.ProtoLang.Lenses | |
Core Language with default types.
type Core' = Core SizeT Double #
Simple void extension with integer size and double prec.
Usage: p :: Program Core'
Lenses
class HasFunCtx p ext | p -> ext where #
Instances
| HasFunCtx (AnnotateEnv ext) ext # | |
Defined in Traq.Analysis.Annotate.Prelude Methods _funCtx :: Lens' (AnnotateEnv ext) (FunCtx ext) # | |
| HasFunCtx (EvaluationEnv ext) ext # | |
Defined in Traq.ProtoLang.Eval Methods _funCtx :: Lens' (EvaluationEnv ext) (FunCtx ext) # | |
| HasFunCtx (FunCtx ext) ext # | |
| HasFunCtx (AnnotateState ext ext') ext' # | |
Defined in Traq.Analysis.Annotate.Prelude Methods _funCtx :: Lens' (AnnotateState ext ext') (FunCtx ext') # | |