Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/Traq/Analysis/Cost/Quantum.hs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ instance CostQ1 Expr where
) =>
Expr ext ->
m cost
costQ1 BasicExprE{basic_expr} = return $ callExpr Classical basic_expr
costQ1 RandomSampleE{distr_expr} = return $ callDistrExpr Classical distr_expr
costQ1 BasicExprE{basic_expr} = return $ callExpr basic_expr
costQ1 RandomSampleE{distr_expr} = return $ callDistrExpr distr_expr
costQ1 FunCallE{fname} = do
fn <- view $ _funCtx . Ctx.at fname . non' (error $ "unable to find function " ++ fname)
costQ1 $ NamedFunDef fname fn
Expand All @@ -110,7 +110,8 @@ instance CostQ1 Stmt where
costQ1 ForS{loop_ty, loop_body} = do
body_cost <- costQ1 loop_body
let n_iters = loop_ty ^?! _Fin
return $ (sizeToPrec n_iters :: prec) Alg..* body_cost
let iter_overhead = callExpr (ParamE "")
return $ (sizeToPrec n_iters :: prec) Alg..* (iter_overhead Alg.+ body_cost)

instance CostQ1 NamedFunDef where
-- query an external function
Expand Down Expand Up @@ -139,8 +140,8 @@ class ExpCostQ1 f where
m cost

instance ExpCostQ1 Expr where
expCostQ1 BasicExprE{basic_expr} _ = return $ callExpr Classical basic_expr
expCostQ1 RandomSampleE{distr_expr} _ = return $ callDistrExpr Classical distr_expr
expCostQ1 BasicExprE{basic_expr} _ = return $ callExpr basic_expr
expCostQ1 RandomSampleE{distr_expr} _ = return $ callDistrExpr distr_expr
expCostQ1 FunCallE{fname, args} sigma = do
fn <- view $ _funCtx . Ctx.at fname . non' (error $ "unable to find function " ++ fname)
let arg_vals = [sigma ^?! at x . non (error $ "could not find var " ++ x) | x <- args]
Expand Down Expand Up @@ -170,11 +171,12 @@ instance ExpCostQ1 Stmt where
env <- view _evaluationEnv
let stepS s sigma_s = eval1 s sigma_s & (runReaderT ?? env)
let bind_ix i s = s & at loop_ix ?~ i
let iter_overhead = callExpr (ParamE "")

(_, cs) <- forAccumM (pure sigma) (domain loop_ty) $ \distr i -> do
let distr_i = fmap (bind_ix i) distr
c <- Prob.expectationA (expCostQ1 loop_body) distr_i
return (distr_i >>= stepS loop_body, c)
return (distr_i >>= stepS loop_body, iter_overhead Alg.+ c)

return $ Alg.sum cs

Expand Down
17 changes: 12 additions & 5 deletions src/Traq/Analysis/Cost/Unitary.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import Traq.Analysis.CostModel.Class
import Traq.Analysis.Prelude
import Traq.CPL.Syntax
import Traq.Prelude
import qualified Traq.QPL.Syntax as QPL

-- | Cost w.r.t. unitary compiler
class
Expand Down Expand Up @@ -73,8 +74,8 @@ instance CostU1 Expr where
) =>
Expr ext ->
m cost
costU1 BasicExprE{basic_expr} = return $ callExpr Unitary basic_expr
costU1 RandomSampleE{distr_expr} = return $ callDistrExpr Unitary distr_expr
costU1 BasicExprE{basic_expr} = return $ callUOp (QPL.RevEmbedU [] basic_expr)
costU1 RandomSampleE{distr_expr} = return $ callUOp (QPL.DistrU distr_expr)
costU1 FunCallE{fname} = do
fn <- view $ _funCtx . Ctx.at fname . non' (error $ "unable to find function " ++ fname)
costU1 $ NamedFunDef fname fn
Expand All @@ -91,16 +92,22 @@ instance CostU1 Stmt where
) =>
Stmt ext ->
m cost
costU1 ExprS{expr} = costU1 expr
costU1 ExprS{expr} = do
expr_cost <- costU1 expr
return $ expr_cost Alg.+ callUOp (QPL.BasicGateU QPL.SWAP)
costU1 IfThenElseS{s_true, s_false} = do
cost_t <- costU1 s_true
cost_f <- costU1 s_false
return $ cost_t Alg.+ cost_f
let copy = callUOp (QPL.BasicGateU QPL.COPY)
let swap = callUOp (QPL.BasicGateU QPL.SWAP)
let cswap = callUOp (QPL.Controlled (QPL.BasicGateU QPL.SWAP))
return $ Alg.sum [copy, copy, cost_t, swap, cost_f, cswap, cswap]
costU1 (SeqS ss) = Alg.sum <$> mapM costU1 ss
costU1 ForS{loop_ty, loop_body} = do
body_cost <- costU1 loop_body
let n_iters = loop_ty ^?! _Fin
return $ (sizeToPrec n_iters :: prec) Alg..* body_cost
let iter_overhead = callUOp (QPL.RevEmbedU [] (ConstE (FinV 0) loop_ty)) Alg.+ callUOp (QPL.BasicGateU QPL.SWAP)
return $ (sizeToPrec n_iters :: prec) Alg..* (iter_overhead Alg.+ body_cost)

instance CostU1 NamedFunDef where
-- query an external function
Expand Down
12 changes: 8 additions & 4 deletions src/Traq/Analysis/CostModel/Class.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import qualified Numeric.Algebra as Alg

import qualified Traq.CPL.Syntax as CPL
import Traq.Prelude
import qualified Traq.QPL.Syntax as QPL

-- | Type of a query/execution: either run on a classical computer, or a quantum computer (as a unitary).
data QueryType = Classical | Unitary
Expand All @@ -17,8 +18,11 @@ class (Alg.Monoidal c, Alg.Module (PrecType c) c) => CostModel c where
-- | Make one query to a function of the given name
query :: QueryType -> Ident -> c

-- | Execute an expression.
callExpr :: QueryType -> CPL.BasicExpr size -> c
-- | Execute a classical expression assignment.
callExpr :: CPL.BasicExpr size -> c

-- | Execute a distribution (randomized) expression
callDistrExpr :: QueryType -> CPL.DistrExpr prec size -> c
-- | Execute a classical distribution (randomized) expression assignment.
callDistrExpr :: (prec ~ PrecType c) => CPL.DistrExpr prec size -> c

-- | Execute a basic unitary operation of QPL
callUOp :: (prec ~ PrecType c) => QPL.Unitary prec size -> c
14 changes: 8 additions & 6 deletions src/Traq/Analysis/CostModel/QueryCost.hs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ instance (Alg.Rig a) => CostModel (QueryCost a) where
query Unitary f = default_{uqueries = Map.singleton f Alg.one}
query Classical f = default_{cqueries = Map.singleton f Alg.one}

-- no cost for basic expressions
callExpr _ _ = default_
callDistrExpr _ _ = default_
-- no cost for basic expressions and ops
callExpr _ = default_
callDistrExpr _ = default_
callUOp _ = default_

{- | A simple cost that counts the number of queries to all external functions.
It treats unitary and classical queries as the same.
Expand All @@ -100,6 +101,7 @@ instance (Alg.Module a a, Alg.Rig a) => CostModel (SimpleQueryCost a) where
-- one query each
query _ _ = SimpleQueryCost Alg.one

-- no cost for basic expressions
callExpr _ _ = SimpleQueryCost Alg.zero
callDistrExpr _ _ = SimpleQueryCost Alg.zero
-- no cost for basic expressions and ops
callExpr _ = SimpleQueryCost Alg.zero
callDistrExpr _ = SimpleQueryCost Alg.zero
callUOp _ = SimpleQueryCost Alg.zero
5 changes: 3 additions & 2 deletions src/Traq/Compiler/Qiskit.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE RecordWildCards #-}

{- HLINT ignore "Use camelCase" -}
Expand Down Expand Up @@ -182,8 +183,8 @@ instance (Show size, Integral size) => ToQiskitPy (QPL.UStmt size) where
mkPy QPL.UForInDomainS{} = pure $ blackbox "UForInDomainS"
mkPy QPL.UWithComputedS{} = pure $ blackbox "UWithComputedS"

instance (Show size, Integral size) => ToQiskitPy (QPL.Unitary size) where
type Ctx (QPL.Unitary size) = [CPL.VarType size]
instance (Show size, Integral size) => ToQiskitPy (QPL.Unitary Double size) where
type Ctx (QPL.Unitary Double size) = [CPL.VarType size]

mkPy (QPL.BasicGateU g) = mkPy g
mkPy (QPL.DistrU d) = error "TODO DistrU"
Expand Down
6 changes: 3 additions & 3 deletions src/Traq/Compiler/Qualtran.hs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
[ py_decorator "attrs.frozen"
, py_class proc_name "qlt.Bloq" class_body
]
mkPy QPL.UProcBody{uproc_param_names, uproc_param_tags, uproc_body_stmt} = do

Check warning on line 136 in src/Traq/Compiler/Qualtran.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.4.8)

Defined but not used: ‘uproc_param_tags’

Check warning on line 136 in src/Traq/Compiler/Qualtran.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.4.8)

Defined but not used: ‘uproc_param_tags’

Check warning on line 136 in src/Traq/Compiler/Qualtran.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.6.7)

Defined but not used: ‘uproc_param_tags’

Check warning on line 136 in src/Traq/Compiler/Qualtran.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.6.7)

Defined but not used: ‘uproc_param_tags’
ProcBuildCtx{..} <- view id
let meta_attrs = map (\p -> py_sanitizeIdent p <> PP.pretty ": int") proc_meta_params
let regs = zipWith py_register uproc_param_names proc_param_types
Expand Down Expand Up @@ -210,21 +210,21 @@
[ PP.pretty "for" <+> py_sanitizeIdent iter_meta_var <+> PP.pretty "in" <+> range_expr <> PP.colon
, py_indent body
]
mkPy QPL.UForInDomainS{iter_meta_var, iter_ty, dagger, uloop_body} = pure $ py_notImplemented "TODO UForInDomainS"

Check warning on line 213 in src/Traq/Compiler/Qualtran.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.4.8)

Defined but not used: ‘uloop_body’

Check warning on line 213 in src/Traq/Compiler/Qualtran.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.4.8)

Defined but not used: ‘dagger’

Check warning on line 213 in src/Traq/Compiler/Qualtran.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.4.8)

Defined but not used: ‘iter_ty’

Check warning on line 213 in src/Traq/Compiler/Qualtran.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.4.8)

Defined but not used: ‘iter_meta_var’

Check warning on line 213 in src/Traq/Compiler/Qualtran.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.4.8)

Defined but not used: ‘uloop_body’

Check warning on line 213 in src/Traq/Compiler/Qualtran.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.4.8)

Defined but not used: ‘dagger’

Check warning on line 213 in src/Traq/Compiler/Qualtran.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.4.8)

Defined but not used: ‘iter_ty’

Check warning on line 213 in src/Traq/Compiler/Qualtran.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.4.8)

Defined but not used: ‘iter_meta_var’

Check warning on line 213 in src/Traq/Compiler/Qualtran.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.6.7)

Defined but not used: ‘uloop_body’

Check warning on line 213 in src/Traq/Compiler/Qualtran.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.6.7)

Defined but not used: ‘dagger’

Check warning on line 213 in src/Traq/Compiler/Qualtran.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.6.7)

Defined but not used: ‘iter_ty’

Check warning on line 213 in src/Traq/Compiler/Qualtran.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.6.7)

Defined but not used: ‘iter_meta_var’

Check warning on line 213 in src/Traq/Compiler/Qualtran.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.6.7)

Defined but not used: ‘uloop_body’

Check warning on line 213 in src/Traq/Compiler/Qualtran.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.6.7)

Defined but not used: ‘dagger’

Check warning on line 213 in src/Traq/Compiler/Qualtran.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.6.7)

Defined but not used: ‘iter_ty’

Check warning on line 213 in src/Traq/Compiler/Qualtran.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.6.7)

Defined but not used: ‘iter_meta_var’
mkPy QPL.UWithComputedS{with_ustmt, body_ustmt} = do
mkPy with_ustmt
mkPy body_ustmt
mkPy (QPL.adjoint with_ustmt)

instance (Show size, Integral size) => ToQualtranPy (QPL.Unitary size) where
type Ctx (QPL.Unitary size) = [CPL.VarType size]
instance (Show size, Integral size, RealFloat prec) => ToQualtranPy (QPL.Unitary prec size) where
type Ctx (QPL.Unitary prec size) = [CPL.VarType size]

mkPy (QPL.BasicGateU g) = mkPy g
mkPy (QPL.DistrU (CPL.UniformE ty)) = do
let bs = CPL.bestBitsize ty
pure $ PP.pretty "QFTTextBook" <> PP.tupled [PP.pretty (show bs)]
mkPy (QPL.DistrU (CPL.BernoulliE p)) = do
let theta = PP.pretty @String $ printf "%f" (2 * asin (sqrt p))
let theta = PP.pretty @String $ printf "%f" (realToFrac @_ @Double $ 2 * asin (sqrt p))
pure $ PP.pretty "qlt_gates.Ry" <> PP.tupled [PP.pretty "angle=" <> theta]
mkPy (QPL.Controlled u) = do
bloq <- mkPy u
Expand All @@ -244,7 +244,7 @@
PP.pretty "NamedBloq"
<> PP.tupled
[ PP.dquotes $ PP.pretty b
, PP.list [py_register ("x_" <> show i) t | (t, i) <- zip ts [0 ..]]

Check warning on line 247 in src/Traq/Compiler/Qualtran.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.4.8)

• Defaulting the type variable ‘a0’ to type ‘Integer’ in the following constraints

Check warning on line 247 in src/Traq/Compiler/Qualtran.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.6.7)

• Defaulting the type variable ‘a0’ to type ‘Integer’ in the following constraints
]

exprToBloq :: (Show size, Integral size) => CPL.BasicExpr size -> Reader (CPL.TypingCtx size) (Py ann)
Expand Down
7 changes: 3 additions & 4 deletions src/Traq/Compiler/Unitary.hs
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,9 @@ instance CompileU1 CPL.Expr where
compileU1 rets CPL.RandomSampleE{distr_expr} = do
rets' <- freshAux rets
return $
USeqS
[ UnitaryS (map Arg rets) (DistrU (CPL.mapPrec realToFrac distr_expr))
, UnitaryS (map Arg (rets ++ rets')) (BasicGateU COPY)
]
UnitaryS
(map Arg (rets ++ rets'))
(DistrU (CPL.mapPrec realToFrac distr_expr))
compileU1 rets CPL.FunCallE{fname, args} = do
let uproc_id = mkUProcName fname
ProcSignature{aux_tys} <- use (_procSignatures . at uproc_id) >>= maybeWithError "cannot find uproc signature"
Expand Down
8 changes: 4 additions & 4 deletions src/Traq/Primitives/Search/QSearchCFNW.hs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ addGroverIteration ::
UQSearchBuilder ext ()
addGroverIteration c x b = do
x_ty <- view $ to search_arg_type
let unifX = QPL.DistrU (CPL.UniformE x_ty)
let unifX = QPL.BasicGateU QPL.Unif
addPredCall c x b
writeElem $ QPL.UnitaryS [x] (QPL.Adjoint unifX)
writeElem $ QPL.UnitaryS [x] (QPL.BasicGateU (QPL.PhaseOnZero pi)) -- reflect on |0>
Expand All @@ -285,7 +285,7 @@ algoQSearchZalkaRandomIterStep r r_reg ctrl_bit x_reg b_reg = do
x_ty <- view $ to search_arg_type

-- uniform r
let prep_r = QPL.UnitaryS [r_reg] (QPL.DistrU (CPL.UniformE r_ty))
let prep_r = QPL.UnitaryS [r_reg] (QPL.BasicGateU QPL.Unif)

withComputed prep_r $ do
-- b in minus state for grover
Expand All @@ -296,7 +296,7 @@ algoQSearchZalkaRandomIterStep r r_reg ctrl_bit x_reg b_reg = do
]
withComputed prep_b $ do
-- uniform x
writeElem $ QPL.UnitaryS [x_reg] (QPL.DistrU (CPL.UniformE x_ty))
writeElem $ QPL.UnitaryS [x_reg] (QPL.BasicGateU QPL.Unif)

-- controlled iterate
let meta_ix_name = "LIM"
Expand Down Expand Up @@ -479,7 +479,7 @@ groverK k (x, x_ty) b mk_pred =
, QPL.adjoint prepb
]
where
unifX = QPL.DistrU (CPL.UniformE x_ty)
unifX = QPL.BasicGateU QPL.Unif

-- map b to |-> and x to uniform
prepb, prepx :: QPL.UStmt size
Expand Down
2 changes: 1 addition & 1 deletion src/Traq/Primitives/Simons/Quantum.hs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ simonsOneRound arg_tys = do
ys' <- lift $ mapM (Compiler.allocAncillaWithPref "yy") arg_tys
aux <- lift $ mapM Compiler.allocAncilla pred_aux_tys

let had_xs = QPL.USeqS [QPL.UnitaryS [QPL.Arg x] (QPL.DistrU $ CPL.UniformE t) | (x, t) <- zip xs arg_tys]
let had_xs = QPL.USeqS [QPL.UnitaryS [QPL.Arg x] (QPL.BasicGateU QPL.Unif) | (x, t) <- zip xs arg_tys]
let call_g = call_upred (map QPL.Arg (xs ++ ys ++ aux))
let copy_out = QPL.USeqS [QPL.UnitaryS [QPL.Arg y, QPL.Arg y'] (QPL.BasicGateU QPL.COPY) | (y, y') <- zip ys ys']

Expand Down
18 changes: 10 additions & 8 deletions src/Traq/QPL/Syntax.hs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ data BasicGate size
| SWAP
| Rz Double
| PhaseOnZero Double
| Unif
deriving (Eq, Show, Read)

instance PP.ToCodeString (BasicGate size) where
Expand All @@ -106,17 +107,18 @@ instance HasAdjoint (BasicGate size) where
adjoint g = g

-- | Unitary operators in QPL
data Unitary size
data Unitary prec size
= BasicGateU (BasicGate size)
| RevEmbedU [Ident] (CPL.BasicExpr size)
| DistrU (CPL.DistrExpr Double size)
| Controlled (Unitary size)
| Adjoint (Unitary size)
| DistrU (CPL.DistrExpr prec size)
| Controlled (Unitary prec size)
| Adjoint (Unitary prec size)
deriving (Eq, Show, Read)

type instance SizeType (Unitary size) = size
type instance SizeType (Unitary prec size) = size
type instance PrecType (Unitary prec size) = prec

instance (Show size) => PP.ToCodeString (Unitary size) where
instance (Show prec, Show size) => PP.ToCodeString (Unitary prec size) where
build (BasicGateU g) = PP.build g
build (RevEmbedU xs e) = do
e_s <- PP.fromBuild e
Expand All @@ -127,7 +129,7 @@ instance (Show size) => PP.ToCodeString (Unitary size) where
build (Controlled u) = PP.putWord . ("Ctrl-" <>) =<< PP.fromBuild u
build (Adjoint u) = PP.putWord . ("Adj-" <>) =<< PP.fromBuild u

instance HasAdjoint (Unitary size) where
instance HasAdjoint (Unitary prec size) where
adjoint (BasicGateU g) = BasicGateU (adjoint g)
adjoint u@(RevEmbedU _ _) = u
adjoint (Controlled u) = Controlled (adjoint u)
Expand All @@ -141,7 +143,7 @@ instance HasAdjoint (Unitary size) where
-- | Unitary Statement
data UStmt size
= USkipS
| UnitaryS {qargs :: [Arg size], unitary :: Unitary size} -- q... *= U
| UnitaryS {qargs :: [Arg size], unitary :: Unitary Double size} -- q... *= U
| UCallS {uproc_id :: Ident, dagger :: Bool, qargs :: [Arg size]} -- call F(q...)
| USeqS [UStmt size] -- W1; W2; ...
| -- placeholders
Expand Down
7 changes: 4 additions & 3 deletions src/Traq/QPL/TypeCheck.hs
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,12 @@
typeCheckBasicGate (PhaseOnZero _) _ = return ()
typeCheckBasicGate COPY tys = let n = length tys `div` 2 in verifyArgTys (take n tys) (drop n tys)
typeCheckBasicGate SWAP tys = let n = length tys `div` 2 in verifyArgTys (take n tys) (drop n tys)
typeCheckBasicGate Unif _ = return ()

typeCheckUnitary :: forall size. (CPL.TypingReqs size) => Unitary size -> [CPL.VarType size] -> TypeChecker size ()
typeCheckUnitary :: forall size prec. (CPL.TypingReqs size) => Unitary prec size -> [CPL.VarType size] -> TypeChecker size ()
typeCheckUnitary (BasicGateU g) tys = typeCheckBasicGate g tys
typeCheckUnitary (DistrU (CPL.UniformE ty)) tys = verifyArgTys tys [ty]
typeCheckUnitary (DistrU (CPL.BernoulliE _)) tys = verifyArgTys tys [CPL.tbool]
typeCheckUnitary (DistrU (CPL.UniformE ty)) tys = verifyArgTys tys [ty, ty]
typeCheckUnitary (DistrU (CPL.BernoulliE _)) tys = verifyArgTys tys [CPL.tbool, CPL.tbool]
typeCheckUnitary (RevEmbedU xs e) tys = do
let in_tys = take (length xs) tys
let gamma = Ctx.fromList $ zip xs in_tys
Expand All @@ -153,7 +154,7 @@
gamma' <- execStateT ?? gamma $ do
all_gamma <- view $ CPL._typingCtx . to Ctx.toList
forM all_gamma $ \(x, ty) ->
when (head x == '#') $

Check warning on line 157 in src/Traq/QPL/TypeCheck.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.8.4)

In the use of ‘head’

Check warning on line 157 in src/Traq/QPL/TypeCheck.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.10.3)

In the use of ‘head’

Check warning on line 157 in src/Traq/QPL/TypeCheck.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.12.2)

In the use of ‘head’
Ctx.ins x .= ty
let res = evalStateT (CPL.typeCheckBasicExpr e) gamma'
case res of
Expand All @@ -161,8 +162,8 @@
Right ret_ty -> verifyArgTys (drop (length xs) tys) [ret_ty]
-- composite gates
typeCheckUnitary (Controlled u) tys = do
verifyArgTys [head tys] [CPL.tbool]

Check warning on line 165 in src/Traq/QPL/TypeCheck.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.8.4)

In the use of ‘head’

Check warning on line 165 in src/Traq/QPL/TypeCheck.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.10.3)

In the use of ‘head’

Check warning on line 165 in src/Traq/QPL/TypeCheck.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.12.2)

In the use of ‘head’
typeCheckUnitary u (tail tys)

Check warning on line 166 in src/Traq/QPL/TypeCheck.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.8.4)

In the use of ‘tail’

Check warning on line 166 in src/Traq/QPL/TypeCheck.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.10.3)

In the use of ‘tail’

Check warning on line 166 in src/Traq/QPL/TypeCheck.hs

View workflow job for this annotation

GitHub Actions / Build and test (cabal) (9.12.2)

In the use of ‘tail’
typeCheckUnitary (Adjoint u) tys = typeCheckUnitary u tys

typeCheckUStmt :: forall size. (CPL.TypingReqs size) => UStmt size -> TypeChecker size ()
Expand Down
2 changes: 1 addition & 1 deletion test/Traq/Examples/MatrixSearchSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ spec = describe "MatrixSearch" $ do
let cost_from_analysis = getCost $ A.costQProg ex'
getCost cost `shouldBeLE` cost_from_analysis

it "target-py-qualtran" $ \ex' -> do
xit "target-py-qualtran" $ \ex' -> do
ex_cqpl <- expectRight $ Compiler.lowerProgram ex'
_ <- evaluate $ force $ Qualtran.toPy ex_cqpl
return ()
Expand Down
Loading