traq
Safe HaskellSafe-Inferred
LanguageHaskell2010

Traq.Compiler.Unitary

Synopsis

Documentation

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 CQPL program.

Class

class TypeInferrable ext (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
(TypeCheckPrim prim (SizeType prim), TypingReqs (SizeType prim), UnitaryCompilePrim prim (SizeType prim) (PrecType 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 => 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))) #

Helpers

allocAncillaWithPref :: sizeT ~ SizeType ext => Ident -> VarType sizeT -> CompilerT ext Ident #

Allocate an ancilla register, and update the typing context.

allocAncilla :: sizeT ~ SizeType ext => VarType sizeT -> CompilerT ext Ident #

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

Internal

compileU1 :: forall ext m. (CompileU1 f, CompileU ext, TypeInferrable ext (SizeType ext), m ~ CompilerT ext) => CompileArgs f ext -> f ext -> m (CompileResult f ext) #