traq
Safe HaskellSafe-Inferred
LanguageHaskell2010

Traq.ProtoLang.Syntax

Synopsis

Syntax

data MetaParam size #

Compile-time constant parameters

Constructors

MetaName String 
MetaSize size 

Instances

Instances details
Read size => Read (MetaParam size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Show size => Show (MetaParam size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

showsPrec :: Int -> MetaParam size -> ShowS #

show :: MetaParam size -> String #

showList :: [MetaParam size] -> ShowS #

Eq size => Eq (MetaParam size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

(==) :: MetaParam size -> MetaParam size -> Bool #

(/=) :: MetaParam size -> MetaParam size -> Bool #

Show size => ToCodeString (MetaParam size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

build :: (MonadWriter [String] m, MonadFail m) => MetaParam size -> m () #

Basic Types

data VarType size #

Types

Constructors

Fin size 
Bitvec size 
Arr size (VarType size) 
Tup [VarType size] 

Instances

Instances details
Functor VarType # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

fmap :: (a -> b) -> VarType a -> VarType b #

(<$) :: a -> VarType b -> VarType a #

Read size => Read (VarType size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Show size => Show (VarType size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

showsPrec :: Int -> VarType size -> ShowS #

show :: VarType size -> String #

showList :: [VarType size] -> ShowS #

Eq size => Eq (VarType size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

(==) :: VarType size -> VarType size -> Bool #

(/=) :: VarType size -> VarType size -> Bool #

MapSize (VarType size) # 
Instance details

Defined in Traq.ProtoLang.Lenses

Associated Types

type MappedSize (VarType size) size' #

Methods

mapSize :: (size0 ~ SizeType (VarType size), size' ~ SizeType ext', ext' ~ MappedSize (VarType size) size') => (size0 -> size') -> VarType size -> ext' #

HasTypingCtx (TypingCtx size) # 
Instance details

Defined in Traq.ProtoLang.TypeCheck

Methods

_typingCtx :: size0 ~ SizeType (TypingCtx size) => Lens' (TypingCtx size) (TypingCtx size0) #

Show a => ToCodeString (VarType a) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

build :: (MonadWriter [String] m, MonadFail m) => VarType a -> m () #

type SizeType (VarType size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

type SizeType (VarType size) = size
type MappedSize (VarType size) size' # 
Instance details

Defined in Traq.ProtoLang.Lenses

type MappedSize (VarType size) size' = VarType size'

_Fin :: Traversal' (VarType size) size #

_Arr :: Traversal' (VarType size) (size, VarType size) #

_Tup :: Traversal' (VarType size) [VarType size] #

data Value size #

Basic Values

Constructors

FinV size

value of type Fin n

ArrV [Value size]

value of type Arr n t

TupV [Value size]

tuple value

Instances

Instances details
Functor Value # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

fmap :: (a -> b) -> Value a -> Value b #

(<$) :: a -> Value b -> Value a #

Read size => Read (Value size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

readsPrec :: Int -> ReadS (Value size) #

readList :: ReadS [Value size] #

readPrec :: ReadPrec (Value size) #

readListPrec :: ReadPrec [Value size] #

Show size => Show (Value size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

showsPrec :: Int -> Value size -> ShowS #

show :: Value size -> String #

showList :: [Value size] -> ShowS #

Eq size => Eq (Value size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

(==) :: Value size -> Value size -> Bool #

(/=) :: Value size -> Value size -> Bool #

Ord size => Ord (Value size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

compare :: Value size -> Value size -> Ordering #

(<) :: Value size -> Value size -> Bool #

(<=) :: Value size -> Value size -> Bool #

(>) :: Value size -> Value size -> Bool #

(>=) :: Value size -> Value size -> Bool #

max :: Value size -> Value size -> Value size #

min :: Value size -> Value size -> Value size #

HasFunInterpCtx (FunInterpCtx size) # 
Instance details

Defined in Traq.ProtoLang.Eval

Methods

_funInterpCtx :: size0 ~ SizeType (FunInterpCtx size) => Lens' (FunInterpCtx size) (FunInterpCtx size0) #

HasProgramState (ProgramState size) # 
Instance details

Defined in Traq.ProtoLang.Eval

Methods

_state :: size0 ~ SizeType (ProgramState size) => Lens' (ProgramState size) (ProgramState size0) #

Show size => ToCodeString (Value size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

build :: (MonadWriter [String] m, MonadFail m) => Value size -> m () #

type SizeType (FunInterp size) # 
Instance details

Defined in Traq.ProtoLang.Eval

type SizeType (FunInterp size) = size
type SizeType (Value size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

type SizeType (Value size) = size

_FinV :: Traversal' (Value size) size #

_ArrV :: Traversal' (Value size) [Value size] #

_TupV :: Traversal' (Value size) [Value size] #

Function types

data FnType size #

Constructors

FnType [VarType size] [VarType size] 

Instances

Instances details
Functor FnType # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

fmap :: (a -> b) -> FnType a -> FnType b #

(<$) :: a -> FnType b -> FnType a #

Read size => Read (FnType size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

readsPrec :: Int -> ReadS (FnType size) #

readList :: ReadS [FnType size] #

readPrec :: ReadPrec (FnType size) #

readListPrec :: ReadPrec [FnType size] #

Show size => Show (FnType size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

showsPrec :: Int -> FnType size -> ShowS #

show :: FnType size -> String #

showList :: [FnType size] -> ShowS #

Eq size => Eq (FnType size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

(==) :: FnType size -> FnType size -> Bool #

(/=) :: FnType size -> FnType size -> Bool #

type SizeType (FnType size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

type SizeType (FnType size) = size

Basic Operations

data UnOp #

Unary operations

Constructors

NotOp 
AnyOp 
AllOp 
MajOp 

Instances

Instances details
Read UnOp # 
Instance details

Defined in Traq.ProtoLang.Syntax

Show UnOp # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

showsPrec :: Int -> UnOp -> ShowS #

show :: UnOp -> String #

showList :: [UnOp] -> ShowS #

Eq UnOp # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

(==) :: UnOp -> UnOp -> Bool #

(/=) :: UnOp -> UnOp -> Bool #

ToCodeString UnOp # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

build :: (MonadWriter [String] m, MonadFail m) => UnOp -> m () #

data BinOp #

Binary operations

Instances

Instances details
Read BinOp # 
Instance details

Defined in Traq.ProtoLang.Syntax

Show BinOp # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

showsPrec :: Int -> BinOp -> ShowS #

show :: BinOp -> String #

showList :: [BinOp] -> ShowS #

Eq BinOp # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

(==) :: BinOp -> BinOp -> Bool #

(/=) :: BinOp -> BinOp -> Bool #

ToCodeString BinOp # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

build :: (MonadWriter [String] m, MonadFail m) => BinOp -> m () #

data NAryOp #

Operations which take multiple arguments

Constructors

MultiOrOp 

Instances

Instances details
Read NAryOp # 
Instance details

Defined in Traq.ProtoLang.Syntax

Show NAryOp # 
Instance details

Defined in Traq.ProtoLang.Syntax

Eq NAryOp # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

(==) :: NAryOp -> NAryOp -> Bool #

(/=) :: NAryOp -> NAryOp -> Bool #

ToCodeString NAryOp # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

build :: (MonadWriter [String] m, MonadFail m) => NAryOp -> m () #

data BasicExpr size #

Basic arithmetic and logical expressions

Constructors

VarE 

Fields

ParamE 

Fields

DefaultE 

Fields

ConstE 

Fields

UnOpE 

Fields

BinOpE 

Fields

TernaryE 

Fields

NAryE 

Fields

IndexE 

Fields

DynIndexE 

Fields

UpdateArrE 

Fields

ProjectE 

Fields

Instances

Instances details
Functor BasicExpr # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

fmap :: (a -> b) -> BasicExpr a -> BasicExpr b #

(<$) :: a -> BasicExpr b -> BasicExpr a #

IsString (BasicExpr size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

fromString :: String -> BasicExpr size #

Read size => Read (BasicExpr size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Show size => Show (BasicExpr size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

showsPrec :: Int -> BasicExpr size -> ShowS #

show :: BasicExpr size -> String #

showList :: [BasicExpr size] -> ShowS #

Eq size => Eq (BasicExpr size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

(==) :: BasicExpr size -> BasicExpr size -> Bool #

(/=) :: BasicExpr size -> BasicExpr size -> Bool #

HasFreeVars (BasicExpr size) # 
Instance details

Defined in Traq.ProtoLang.Vars

Methods

freeVarsList :: BasicExpr size -> [Ident] #

RenameVars (BasicExpr size) # 
Instance details

Defined in Traq.ProtoLang.Vars

Methods

renameVars :: Ident -> BasicExpr size -> BasicExpr size #

renameVars' :: BasicExpr size -> BasicExpr size #

Show size => ToCodeString (BasicExpr size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

build :: (MonadWriter [String] m, MonadFail m) => BasicExpr size -> m () #

(.<=.) :: BasicExpr size -> BasicExpr size -> BasicExpr size #

notE :: BasicExpr size -> BasicExpr size #

(.+.) :: BasicExpr size -> BasicExpr size -> BasicExpr size #

(.&&.) :: BasicExpr size -> BasicExpr size -> BasicExpr size #

Expressions and Statements

data DistrExpr size #

An expression denoting a probablity distribution.

Constructors

UniformE 

Fields

BernoulliE 

Fields

Instances

Instances details
Functor DistrExpr # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

fmap :: (a -> b) -> DistrExpr a -> DistrExpr b #

(<$) :: a -> DistrExpr b -> DistrExpr a #

Read size => Read (DistrExpr size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Show size => Show (DistrExpr size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

showsPrec :: Int -> DistrExpr size -> ShowS #

show :: DistrExpr size -> String #

showList :: [DistrExpr size] -> ShowS #

Eq size => Eq (DistrExpr size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

(==) :: DistrExpr size -> DistrExpr size -> Bool #

(/=) :: DistrExpr size -> DistrExpr size -> Bool #

HasFreeVars (DistrExpr size) # 
Instance details

Defined in Traq.ProtoLang.Vars

Methods

freeVarsList :: DistrExpr size -> [Ident] #

Show size => ToCodeString (DistrExpr size) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

build :: (MonadWriter [String] m, MonadFail m) => DistrExpr size -> m () #

TypingReqs size => TypeInferrable (DistrExpr size) size # 
Instance details

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) # 
Instance details

Defined in Traq.ProtoLang.Syntax

type SizeType (DistrExpr size) = size

data Expr ext #

An expression in the prototype language. It appears as the RHS of an assignment statement.

Constructors

BasicExprE 

Fields

RandomSampleE 

Fields

FunCallE 

Fields

PrimCallE 

Fields

LoopE 

Instances

Instances details
(Read ext, Read (SizeType ext)) => Read (Expr ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

readsPrec :: Int -> ReadS (Expr ext) #

readList :: ReadS [Expr ext] #

readPrec :: ReadPrec (Expr ext) #

readListPrec :: ReadPrec [Expr ext] #

(Show ext, Show (SizeType ext)) => Show (Expr ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

showsPrec :: Int -> Expr ext -> ShowS #

show :: Expr ext -> String #

showList :: [Expr ext] -> ShowS #

(Eq ext, Eq (SizeType ext)) => Eq (Expr ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

(==) :: Expr ext -> Expr ext -> Bool #

(/=) :: Expr ext -> Expr ext -> Bool #

MapSize ext => MapSize (Expr ext) # 
Instance details

Defined in Traq.ProtoLang.Lenses

Associated Types

type MappedSize (Expr ext) size' #

Methods

mapSize :: (size ~ SizeType (Expr ext), size' ~ SizeType ext', ext' ~ MappedSize (Expr ext) size') => (size -> size') -> Expr ext -> ext' #

(Parseable ext, SizeType ext ~ SymbSize) => Parseable (Expr ext) # 
Instance details

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

Instance details

Defined in Traq.ProtoLang.Vars

Methods

freeVarsList :: Expr ext -> [Ident] #

RenameVars ext => RenameVars (Expr ext) # 
Instance details

Defined in Traq.ProtoLang.Vars

Methods

renameVars :: Ident -> Expr ext -> Expr ext #

renameVars' :: Expr ext -> Expr ext #

(Show (SizeType ext), ToCodeString ext) => ToCodeString (Expr ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

build :: (MonadWriter [String] m, MonadFail m) => Expr ext -> m () #

TypeInferrable ext size => TypeInferrable (Expr ext) size # 
Instance details

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 # 
Instance details

Defined in Traq.Analysis.Error.Quantum

Methods

tvErrorQ :: forall ext' m. (m ~ ErrorAnalysisMonad ext', TVErrorQ ext' size prec, SizeType ext' ~ size, PrecType ext' ~ prec) => Expr ext -> m (FailProb prec) #

TraceNormErrorU ext size prec => TraceNormErrorU (Expr ext) size prec # 
Instance details

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 # 
Instance details

Defined in Traq.ProtoLang.Eval

type PrecType (Expr ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

type PrecType (Expr ext) = PrecType ext
type SizeType (Expr ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

type SizeType (Expr ext) = SizeType ext
type MappedSize (Expr ext) size' # 
Instance details

Defined in Traq.ProtoLang.Lenses

type MappedSize (Expr ext) size' = Expr (MappedSize ext size')

data Stmt ext #

A statement in the prototype language.

Constructors

ExprS 

Fields

IfThenElseS 

Fields

SeqS [Stmt ext] 

Instances

Instances details
(Read ext, Read (SizeType ext)) => Read (Stmt ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

readsPrec :: Int -> ReadS (Stmt ext) #

readList :: ReadS [Stmt ext] #

readPrec :: ReadPrec (Stmt ext) #

readListPrec :: ReadPrec [Stmt ext] #

(Show ext, Show (SizeType ext)) => Show (Stmt ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

showsPrec :: Int -> Stmt ext -> ShowS #

show :: Stmt ext -> String #

showList :: [Stmt ext] -> ShowS #

(Eq ext, Eq (SizeType ext)) => Eq (Stmt ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

(==) :: Stmt ext -> Stmt ext -> Bool #

(/=) :: Stmt ext -> Stmt ext -> Bool #

MapSize ext => MapSize (Stmt ext) # 
Instance details

Defined in Traq.ProtoLang.Lenses

Associated Types

type MappedSize (Stmt ext) size' #

Methods

mapSize :: (size ~ SizeType (Stmt ext), size' ~ SizeType ext', ext' ~ MappedSize (Stmt ext) size') => (size -> size') -> Stmt ext -> ext' #

(Parseable ext, SizeType ext ~ SymbSize) => Parseable (Stmt ext) # 
Instance details

Defined in Traq.ProtoLang.Parser

Methods

parseE :: TokenParser () -> Parser (Stmt ext) #

HasFreeVars ext => HasFreeVars (Stmt ext) #

The set of free (unbound) variables

Instance details

Defined in Traq.ProtoLang.Vars

Methods

freeVarsList :: Stmt ext -> [Ident] #

RenameVars ext => RenameVars (Stmt ext) # 
Instance details

Defined in Traq.ProtoLang.Vars

Methods

renameVars :: Ident -> Stmt ext -> Stmt ext #

renameVars' :: Stmt ext -> Stmt ext #

HasAst (Stmt ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

_ast :: Traversal' (Stmt ext) (Stmt ext) #

HasStmt (Stmt ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Associated Types

type StmtOf (Stmt ext) #

Methods

_stmt :: Traversal' (Stmt ext) (StmtOf (Stmt ext)) #

(Show (SizeType ext), ToCodeString ext) => ToCodeString (Stmt ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

build :: (MonadWriter [String] m, MonadFail m) => Stmt ext -> m () #

TypeInferrable ext size => TypeInferrable (Stmt ext) size # 
Instance details

Defined in Traq.ProtoLang.TypeCheck

Methods

inferTypes :: forall ext' m. (m ~ TypeChecker ext', size ~ SizeType ext') => Stmt ext -> m [VarType size] #

TVErrorQ ext size prec => TVErrorQ (Stmt ext) size prec # 
Instance details

Defined in Traq.Analysis.Error.Quantum

Methods

tvErrorQ :: forall ext' m. (m ~ ErrorAnalysisMonad ext', TVErrorQ ext' size prec, SizeType ext' ~ size, PrecType ext' ~ prec) => Stmt ext -> m (FailProb prec) #

TraceNormErrorU ext size prec => TraceNormErrorU (Stmt ext) size prec # 
Instance details

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 EvalArgs Stmt ext # 
Instance details

Defined in Traq.ProtoLang.Eval

type PrecType (Stmt ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

type PrecType (Stmt ext) = PrecType ext
type SizeType (Stmt ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

type SizeType (Stmt ext) = SizeType ext
type StmtOf (Stmt ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

type StmtOf (Stmt ext) = Stmt ext
type MappedSize (Stmt ext) size' # 
Instance details

Defined in Traq.ProtoLang.Lenses

type MappedSize (Stmt ext) size' = Stmt (MappedSize ext size')

data FunBody ext #

The body of a function.

Constructors

FunBody 

Fields

Instances

Instances details
(Read ext, Read (SizeType ext)) => Read (FunBody ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

(Show ext, Show (SizeType ext)) => Show (FunBody ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

showsPrec :: Int -> FunBody ext -> ShowS #

show :: FunBody ext -> String #

showList :: [FunBody ext] -> ShowS #

(Eq ext, Eq (SizeType ext)) => Eq (FunBody ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

(==) :: FunBody ext -> FunBody ext -> Bool #

(/=) :: FunBody ext -> FunBody ext -> Bool #

MapSize ext => MapSize (FunBody ext) # 
Instance details

Defined in Traq.ProtoLang.Lenses

Associated Types

type MappedSize (FunBody ext) size' #

Methods

mapSize :: (size ~ SizeType (FunBody ext), size' ~ SizeType ext', ext' ~ MappedSize (FunBody ext) size') => (size -> size') -> FunBody ext -> ext' #

RenameVars ext => RenameVars (FunBody ext) # 
Instance details

Defined in Traq.ProtoLang.Vars

Methods

renameVars :: Ident -> FunBody ext -> FunBody ext #

renameVars' :: FunBody ext -> FunBody ext #

HasStmt (FunBody ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Associated Types

type StmtOf (FunBody ext) #

Methods

_stmt :: Traversal' (FunBody ext) (StmtOf (FunBody ext)) #

type EvalArgs FunBody ext # 
Instance details

Defined in Traq.ProtoLang.Eval

type EvalArgs FunBody ext = [Value (SizeType ext)]
type PrecType (FunBody ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

type PrecType (FunBody ext) = PrecType ext
type SizeType (FunBody ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

type SizeType (FunBody ext) = SizeType ext
type StmtOf (FunBody ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

type StmtOf (FunBody ext) = Stmt ext
type MappedSize (FunBody ext) size' # 
Instance details

Defined in Traq.ProtoLang.Lenses

type MappedSize (FunBody ext) size' = FunBody (MappedSize ext size')

data FunDef ext #

A function definition or declaration in the prototype language.

Constructors

FunDef 

Fields

Instances

Instances details
(Read ext, Read (SizeType ext)) => Read (FunDef ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

(Show ext, Show (SizeType ext)) => Show (FunDef ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

showsPrec :: Int -> FunDef ext -> ShowS #

show :: FunDef ext -> String #

showList :: [FunDef ext] -> ShowS #

(Eq ext, Eq (SizeType ext)) => Eq (FunDef ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

(==) :: FunDef ext -> FunDef ext -> Bool #

(/=) :: FunDef ext -> FunDef ext -> Bool #

MapSize ext => MapSize (FunDef ext) # 
Instance details

Defined in Traq.ProtoLang.Lenses

Associated Types

type MappedSize (FunDef ext) size' #

Methods

mapSize :: (size ~ SizeType (FunDef ext), size' ~ SizeType ext', ext' ~ MappedSize (FunDef ext) size') => (size -> size') -> FunDef ext -> ext' #

RenameVars ext => RenameVars (FunDef ext) # 
Instance details

Defined in Traq.ProtoLang.Vars

Methods

renameVars :: Ident -> FunDef ext -> FunDef ext #

renameVars' :: FunDef ext -> FunDef ext #

HasStmt (FunDef ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Associated Types

type StmtOf (FunDef ext) #

Methods

_stmt :: Traversal' (FunDef ext) (StmtOf (FunDef ext)) #

HasFunCtx (FunCtx ext) ext # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

_funCtx :: Lens' (FunCtx ext) (FunCtx ext) #

TVErrorQ ext size prec => TVErrorQ (FunDef ext) size prec # 
Instance details

Defined in Traq.Analysis.Error.Quantum

Methods

tvErrorQ :: forall ext' m. (m ~ ErrorAnalysisMonad ext', TVErrorQ ext' size prec, SizeType ext' ~ size, PrecType ext' ~ prec) => FunDef ext -> m (FailProb prec) #

TraceNormErrorU ext size prec => TraceNormErrorU (FunDef ext) size prec # 
Instance details

Defined in Traq.Analysis.Error.Unitary

Methods

traceNormErrorU :: forall ext' m. (m ~ ErrorAnalysisMonad ext', TraceNormErrorU ext' size prec, SizeType ext' ~ size, PrecType ext' ~ prec) => FunDef ext -> m (FailProb prec) #

type PrecType (FunDef ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

type PrecType (FunDef ext) = PrecType ext
type SizeType (FunDef ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

type SizeType (FunDef ext) = SizeType ext
type StmtOf (FunDef ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

type StmtOf (FunDef ext) = Stmt ext
type MappedSize (FunDef ext) size' # 
Instance details

Defined in Traq.ProtoLang.Lenses

type MappedSize (FunDef ext) size' = FunDef (MappedSize ext size')

data NamedFunDef ext #

A function with a name

Constructors

NamedFunDef 

Fields

Instances

Instances details
(Read ext, Read (SizeType ext)) => Read (NamedFunDef ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

(Show ext, Show (SizeType ext)) => Show (NamedFunDef ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

showsPrec :: Int -> NamedFunDef ext -> ShowS #

show :: NamedFunDef ext -> String #

showList :: [NamedFunDef ext] -> ShowS #

(Eq ext, Eq (SizeType ext)) => Eq (NamedFunDef ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

(==) :: NamedFunDef ext -> NamedFunDef ext -> Bool #

(/=) :: NamedFunDef ext -> NamedFunDef ext -> Bool #

MapSize ext => MapSize (NamedFunDef ext) # 
Instance details

Defined in Traq.ProtoLang.Lenses

Associated Types

type MappedSize (NamedFunDef ext) size' #

Methods

mapSize :: (size ~ SizeType (NamedFunDef ext), size' ~ SizeType ext', ext' ~ MappedSize (NamedFunDef ext) size') => (size -> size') -> NamedFunDef ext -> ext' #

RenameVars ext => RenameVars (NamedFunDef ext) # 
Instance details

Defined in Traq.ProtoLang.Vars

HasStmt (NamedFunDef ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Associated Types

type StmtOf (NamedFunDef ext) #

(Show (SizeType ext), ToCodeString ext) => ToCodeString (NamedFunDef ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

build :: (MonadWriter [String] m, MonadFail m) => NamedFunDef ext -> m () #

TraceNormErrorU ext size prec => TraceNormErrorU (NamedFunDef ext) size prec # 
Instance details

Defined in Traq.Analysis.Error.Unitary

Methods

traceNormErrorU :: forall ext' m. (m ~ ErrorAnalysisMonad ext', TraceNormErrorU ext' size prec, SizeType ext' ~ size, PrecType ext' ~ prec) => NamedFunDef ext -> m (FailProb prec) #

type EvalArgs NamedFunDef ext # 
Instance details

Defined in Traq.ProtoLang.Eval

type EvalArgs NamedFunDef ext = [Value (SizeType ext)]
type PrecType (NamedFunDef ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

type PrecType (NamedFunDef ext) = PrecType ext
type SizeType (NamedFunDef ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

type SizeType (NamedFunDef ext) = SizeType ext
type StmtOf (NamedFunDef ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

type StmtOf (NamedFunDef ext) = Stmt ext
type MappedSize (NamedFunDef ext) size' # 
Instance details

Defined in Traq.ProtoLang.Lenses

type MappedSize (NamedFunDef ext) size' = NamedFunDef (MappedSize ext size')

newtype Program ext #

A program is a list of named functions, with the last being the entry point.

Constructors

Program [NamedFunDef ext] 

Instances

Instances details
(Read ext, Read (SizeType ext)) => Read (Program ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

(Show ext, Show (SizeType ext)) => Show (Program ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

showsPrec :: Int -> Program ext -> ShowS #

show :: Program ext -> String #

showList :: [Program ext] -> ShowS #

(Eq ext, Eq (SizeType ext)) => Eq (Program ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

(==) :: Program ext -> Program ext -> Bool #

(/=) :: Program ext -> Program ext -> Bool #

MapSize ext => MapSize (Program ext) # 
Instance details

Defined in Traq.ProtoLang.Lenses

Associated Types

type MappedSize (Program ext) size' #

Methods

mapSize :: (size ~ SizeType (Program ext), size' ~ SizeType ext', ext' ~ MappedSize (Program ext) size') => (size -> size') -> Program ext -> ext' #

RenameVars ext => RenameVars (Program ext) # 
Instance details

Defined in Traq.ProtoLang.Vars

Methods

renameVars :: Ident -> Program ext -> Program ext #

renameVars' :: Program ext -> Program ext #

HasStmt (Program ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Associated Types

type StmtOf (Program ext) #

Methods

_stmt :: Traversal' (Program ext) (StmtOf (Program ext)) #

(Show (SizeType ext), ToCodeString ext) => ToCodeString (Program ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

build :: (MonadWriter [String] m, MonadFail m) => Program ext -> m () #

type EvalArgs Program ext # 
Instance details

Defined in Traq.ProtoLang.Eval

type EvalArgs Program ext = [Value (SizeType ext)]
type PrecType (Program ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

type PrecType (Program ext) = PrecType ext
type SizeType (Program ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

type SizeType (Program ext) = SizeType ext
type StmtOf (Program ext) # 
Instance details

Defined in Traq.ProtoLang.Syntax

type StmtOf (Program ext) = Stmt ext
type MappedSize (Program ext) size' # 
Instance details

Defined in Traq.ProtoLang.Lenses

type MappedSize (Program ext) size' = Program (MappedSize ext size')

FunCtx

type FunCtx ext = Context (FunDef ext) #

A function context contains a list of functions

Core

data Core size prec #

Void extension (i.e. only use the core language) Usage: p :: Program (Core size prec)

Instances

Instances details
TypingReqs size => CompileQ (AnnFailProb (Core size prec)) # 
Instance details

Defined in Traq.Compiler.Quantum

Methods

compileQ :: forall ext' m. (m ~ CompilerT ext', SizeType (AnnFailProb (Core size prec)) ~ SizeType ext', PrecType (AnnFailProb (Core size prec)) ~ PrecType ext', CompileQ ext') => AnnFailProb (Core size prec) -> [Ident] -> m (Stmt (SizeType (AnnFailProb (Core size prec)))) #

TypingReqs size => CompileU (AnnFailProb (Core size prec)) # 
Instance details

Defined in Traq.Compiler.Unitary

Methods

compileU :: forall ext' m. (m ~ CompilerT ext', SizeType (AnnFailProb (Core size prec)) ~ SizeType ext', PrecType (AnnFailProb (Core size prec)) ~ PrecType ext') => AnnFailProb (Core size prec) -> [Ident] -> m (UStmt (SizeType (AnnFailProb (Core size prec)))) #

CostReqs size prec => CostQ (AnnFailProb (Core size prec)) size prec # 
Instance details

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 # 
Instance details

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 # 
Instance details

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) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

readsPrec :: Int -> ReadS (Core size prec) #

readList :: ReadS [Core size prec] #

readPrec :: ReadPrec (Core size prec) #

readListPrec :: ReadPrec [Core size prec] #

Show (Core size prec) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

showsPrec :: Int -> Core size prec -> ShowS #

show :: Core size prec -> String #

showList :: [Core size prec] -> ShowS #

Eq (Core size prec) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

(==) :: Core size prec -> Core size prec -> Bool #

(/=) :: Core size prec -> Core size prec -> Bool #

TypingReqs size => CompileQ (Core size prec) # 
Instance details

Defined in Traq.Compiler.Quantum

Methods

compileQ :: forall ext' m. (m ~ CompilerT ext', SizeType (Core size prec) ~ SizeType ext', PrecType (Core size prec) ~ PrecType ext', CompileQ ext') => Core size prec -> [Ident] -> m (Stmt (SizeType (Core size prec))) #

TypingReqs size => CompileU (Core size prec) # 
Instance details

Defined in Traq.Compiler.Unitary

Methods

compileU :: forall ext' m. (m ~ CompilerT ext', SizeType (Core size prec) ~ SizeType ext', PrecType (Core size prec) ~ PrecType ext') => Core size prec -> [Ident] -> m (UStmt (SizeType (Core size prec))) #

MapSize (Core size prec) # 
Instance details

Defined in Traq.ProtoLang.Lenses

Associated Types

type MappedSize (Core size prec) size' #

Methods

mapSize :: (size0 ~ SizeType (Core size prec), size' ~ SizeType ext', ext' ~ MappedSize (Core size prec) size') => (size0 -> size') -> Core size prec -> ext' #

HasFreeVars (Core size prec) # 
Instance details

Defined in Traq.ProtoLang.Vars

Methods

freeVarsList :: Core size prec -> [Ident] #

RenameVars (Core size prec) # 
Instance details

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) # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

build :: (MonadWriter [String] m, MonadFail m) => Core size prec -> m () #

TypingReqs size => TypeInferrable (Core size prec) size # 
Instance details

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 # 
Instance details

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 # 
Instance details

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 # 
Instance details

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 # 
Instance details

Defined in Traq.Analysis.Error.Quantum

Methods

tvErrorQ :: forall ext' m. (m ~ ErrorAnalysisMonad ext', TVErrorQ ext' size prec, SizeType ext' ~ size, PrecType ext' ~ prec) => Core size prec -> m (FailProb prec) #

ErrorReqs size prec => TraceNormErrorU (Core size prec) size prec # 
Instance details

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 # 
Instance details

Defined in Traq.ProtoLang.Eval

Methods

eval :: (Evaluatable ext' SizeT prec, m ~ Evaluator ext', SizeType ext' ~ SizeT, PrecType ext' ~ prec) => Core SizeT prec -> ProgramState SizeT -> m [Value SizeT] #

type PrecType (Core size prec) # 
Instance details

Defined in Traq.ProtoLang.Syntax

type PrecType (Core size prec) = prec
type SizeType (Core size prec) # 
Instance details

Defined in Traq.ProtoLang.Syntax

type SizeType (Core size prec) = size
type MappedSize (Core size prec) size' # 
Instance details

Defined in Traq.ProtoLang.Lenses

type MappedSize (Core size prec) size' = Core size' prec

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 #

Methods

_funCtx :: Lens' p (FunCtx ext) #

Instances

Instances details
HasFunCtx (AnnotateEnv ext) ext # 
Instance details

Defined in Traq.Analysis.Annotate.Prelude

Methods

_funCtx :: Lens' (AnnotateEnv ext) (FunCtx ext) #

HasFunCtx (EvaluationEnv ext) ext # 
Instance details

Defined in Traq.ProtoLang.Eval

Methods

_funCtx :: Lens' (EvaluationEnv ext) (FunCtx ext) #

HasFunCtx (FunCtx ext) ext # 
Instance details

Defined in Traq.ProtoLang.Syntax

Methods

_funCtx :: Lens' (FunCtx ext) (FunCtx ext) #

HasFunCtx (AnnotateState ext ext') ext' # 
Instance details

Defined in Traq.Analysis.Annotate.Prelude

Methods

_funCtx :: Lens' (AnnotateState ext ext') (FunCtx ext') #