| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Traq.ProtoLang.Syntax
Synopsis
- data MetaParam size
- data VarType size
- _Fin :: Traversal' (VarType size) size
- _Arr :: Traversal' (VarType size) (size, VarType size)
- _Tup :: Traversal' (VarType size) [VarType size]
- data Value size
- _FinV :: Traversal' (Value size) size
- _ArrV :: Traversal' (Value size) [Value size]
- _TupV :: Traversal' (Value size) [Value size]
- data FnType size = FnType [VarType size] [VarType size]
- data UnOp
- data BinOp
- data NAryOp = MultiOrOp
- data BasicExpr size
- (.<=.) :: BasicExpr size -> BasicExpr size -> BasicExpr size
- notE :: BasicExpr size -> BasicExpr size
- (.+.) :: BasicExpr size -> BasicExpr size -> BasicExpr size
- (.&&.) :: BasicExpr size -> BasicExpr size -> BasicExpr size
- data DistrExpr size
- 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 size prec
- type Core' = Core SizeT Double
- class HasFunCtx p ext | p -> ext where
Syntax
Compile-time constant parameters
Basic Types
Types
Instances
| Functor VarType # | |
| Read size => Read (VarType size) # | |
| Show size => Show (VarType size) # | |
| Eq size => Eq (VarType size) # | |
| MapSize (VarType size) # | |
Defined in Traq.ProtoLang.Lenses Associated Types type MappedSize (VarType size) size' # | |
| HasTypingCtx (TypingCtx size) # | |
Defined in Traq.ProtoLang.TypeCheck | |
| Show a => ToCodeString (VarType a) # | |
Defined in Traq.ProtoLang.Syntax | |
| type SizeType (VarType size) # | |
Defined in Traq.ProtoLang.Syntax | |
| type MappedSize (VarType size) size' # | |
Defined in Traq.ProtoLang.Lenses | |
_Fin :: Traversal' (VarType size) size #
_Arr :: Traversal' (VarType size) (size, VarType size) #
_Tup :: Traversal' (VarType size) [VarType size] #
Basic Values
Constructors
| FinV size | value of type |
| ArrV [Value size] | value of type |
| TupV [Value size] | tuple value |
Instances
| Functor Value # | |
| Read size => Read (Value size) # | |
| Show size => Show (Value size) # | |
| Eq size => Eq (Value size) # | |
| Ord size => Ord (Value size) # | |
Defined in Traq.ProtoLang.Syntax | |
| HasFunInterpCtx (FunInterpCtx size) # | |
Defined in Traq.ProtoLang.Eval Methods _funInterpCtx :: size0 ~ SizeType (FunInterpCtx size) => Lens' (FunInterpCtx size) (FunInterpCtx size0) # | |
| HasProgramState (ProgramState size) # | |
Defined in Traq.ProtoLang.Eval Methods _state :: size0 ~ SizeType (ProgramState size) => Lens' (ProgramState size) (ProgramState size0) # | |
| Show size => ToCodeString (Value size) # | |
Defined in Traq.ProtoLang.Syntax | |
| type SizeType (FunInterp size) # | |
Defined in Traq.ProtoLang.Eval | |
| type SizeType (Value size) # | |
Defined in Traq.ProtoLang.Syntax | |
_FinV :: Traversal' (Value size) size #
_ArrV :: Traversal' (Value size) [Value size] #
_TupV :: Traversal' (Value size) [Value size] #
Function types
Basic Operations
Unary operations
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 size) # | |
Defined in Traq.ProtoLang.Syntax Methods fromString :: String -> BasicExpr size # | |
| Read size => Read (BasicExpr size) # | |
| Show size => Show (BasicExpr size) # | |
| Eq size => Eq (BasicExpr size) # | |
| HasFreeVars (BasicExpr size) # | |
Defined in Traq.ProtoLang.Vars Methods freeVarsList :: BasicExpr size -> [Ident] # | |
| RenameVars (BasicExpr size) # | |
Defined in Traq.ProtoLang.Vars Methods renameVars :: Ident -> BasicExpr size -> BasicExpr size # renameVars' :: BasicExpr size -> BasicExpr size # | |
| Show size => ToCodeString (BasicExpr size) # | |
Defined in Traq.ProtoLang.Syntax | |
Expressions and Statements
An expression denoting a probablity distribution.
Instances
| Functor DistrExpr # | |
| Read size => Read (DistrExpr size) # | |
| Show size => Show (DistrExpr size) # | |
| Eq size => Eq (DistrExpr size) # | |
| HasFreeVars (DistrExpr size) # | |
Defined in Traq.ProtoLang.Vars Methods freeVarsList :: DistrExpr size -> [Ident] # | |
| Show size => ToCodeString (DistrExpr size) # | |
Defined in Traq.ProtoLang.Syntax | |
| TypingReqs size => TypeInferrable (DistrExpr size) size # | |
Defined in Traq.ProtoLang.TypeCheck Methods inferTypes :: forall ext' m. (m ~ TypeChecker ext', size ~ SizeType ext') => DistrExpr size -> m [VarType size] # | |
| type SizeType (DistrExpr size) # | |
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 | |
| (Show (SizeType ext), ToCodeString ext) => ToCodeString (Expr ext) # | |
Defined in Traq.ProtoLang.Syntax | |
| TypeInferrable ext size => TypeInferrable (Expr ext) size # | |
Defined in Traq.ProtoLang.TypeCheck Methods inferTypes :: forall ext' m. (m ~ TypeChecker ext', size ~ SizeType ext') => Expr ext -> m [VarType size] # | |
| 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) # | |
| type EvalArgs Expr ext # | |
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
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 # renameVars' :: FunBody ext -> FunBody ext # | |
| HasStmt (FunBody ext) # | |
Defined in Traq.ProtoLang.Syntax | |
| type EvalArgs FunBody ext # | |
Defined in Traq.ProtoLang.Eval | |
| 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 # renameVars' :: 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 EvalArgs Program ext # | |
Defined in Traq.ProtoLang.Eval | |
| 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 size prec)
Instances
| TypingReqs size => CompileQ (AnnFailProb (Core size prec)) # | |
Defined in Traq.Compiler.Quantum | |
| TypingReqs size => CompileU (AnnFailProb (Core size prec)) # | |
Defined in Traq.Compiler.Unitary | |
| CostReqs size prec => CostQ (AnnFailProb (Core size prec)) size prec # | |
Defined in Traq.Analysis.Annotate.Prelude Methods costQ :: forall ext' cost m. (m ~ CostAnalysisMonad ext', CostQ ext' size prec, CostModelReqs size prec cost) => AnnFailProb (Core size prec) -> m cost # | |
| (CostReqs size prec, EvalReqs size prec) => ExpCostQ (AnnFailProb (Core size prec)) size prec # | |
Defined in Traq.Analysis.Annotate.Prelude Methods expCostQ :: forall ext' cost m. (m ~ CostAnalysisMonad ext', ExpCostQ ext' size prec, CostModelReqs size prec cost) => AnnFailProb (Core size prec) -> ProgramState size -> m cost # | |
| CostReqs size prec => CostU (AnnFailProb (Core size prec)) size prec # | |
Defined in Traq.Analysis.Annotate.Prelude Methods costU :: forall ext' costT m. (m ~ CostAnalysisMonad ext', CostU ext' size prec, CostModelReqs size prec costT) => AnnFailProb (Core size prec) -> m costT # | |
| Read (Core size prec) # | |
| Show (Core size prec) # | |
| Eq (Core size prec) # | |
| 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] # | |
| RenameVars (Core size prec) # | |
Defined in Traq.ProtoLang.Vars Methods renameVars :: Ident -> Core size prec -> Core size prec # renameVars' :: Core size prec -> Core size prec # | |
| ToCodeString (Core size prec) # | |
Defined in Traq.ProtoLang.Syntax | |
| TypingReqs size => TypeInferrable (Core size prec) size # | |
Defined in Traq.ProtoLang.TypeCheck Methods inferTypes :: forall ext' m. (m ~ TypeChecker ext', size ~ SizeType ext') => Core size prec -> m [VarType size] # | |
| 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 prec => Evaluatable (Core SizeT prec) SizeT prec # | |
| 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') # | |