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
(Integral sizeT, Floating precT, RealFloat precT, TypingReqs sizeT, Show precT, SizeToPrec sizeT precT) => CompileU (AnnFailProb (DefaultPrims sizeT precT)) # 
Instance details

Defined in Traq.Primitives

Methods

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

(Integral sizeT, RealFloat precT, Show sizeT, Show precT, TypingReqs sizeT, SizeToPrec sizeT precT) => CompileU (AnnFailProb (Primitive (QSearchCFNW sizeT precT))) # 
Instance details

Defined in Traq.Primitives.Search.QSearchCFNW

Methods

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

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