traq
Safe HaskellSafe-Inferred
LanguageHaskell2010

Traq.Compiler

Synopsis

Documentation

class (TypeInferrable ext (SizeType ext), Integral (SizeType ext)) => CompileU ext where #

Methods

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

Instances

Instances details
(TypingReqs size, Integral 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)))) #

(TypeCheckPrim prim (SizeType prim), TypingReqs (SizeType prim), UnitaryCompilePrim prim (SizeType prim) (PrecType prim), Integral (SizeType prim)) => CompileU (AnnFailProb (Primitive prim)) # 
Instance details

Defined in Traq.Primitives.Class

Methods

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

(TypingReqs size, Integral 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))) #

lowerProgramU :: forall ext size prec. (CompileU ext, Show prec, Floating prec, HasFreeVars ext, prec ~ PrecType ext, size ~ SizeType ext, TypeInferrable ext size) => Program ext -> Either String (Program size) #

Lower a full program into a unitary QPL program.

allocAncillaWithPref :: (size ~ SizeType ext, Eq size) => Ident -> VarType size -> CompilerT ext Ident #

Allocate an ancilla register, and update the typing context.

allocAncilla :: (size ~ SizeType ext, Eq size) => VarType size -> CompilerT ext Ident #

Allocate an ancilla register aux_, and update the typing context.