quipper-demos-0.9.0.0: dist/build/Example3/Example3-tmp/Quipper/Demos/Example3.hs
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
{-# LINE 1 "Quipper/Demos/Example3.hs" #-}
import Quipper
example1 :: (Qubit,Qubit,Qubit,Qubit) -> Circ (Qubit,Qubit,Qubit,Qubit)
example1 (q, a, b, c) = do
hadamard a
qnot_at c `controlled` [a, b]
hadamard q `controlled` [c]
qnot_at c `controlled` [a, b]
hadamard a
return (q, a, b, c)
example3 :: (Qubit,Qubit,Qubit,Qubit,Qubit,Qubit) -> Circ (Qubit,Qubit,Qubit,Qubit,Qubit,Qubit)
example3 (q, a, b, c, d, e) = do
example1 (q, a, b, c)
with_controls (d .==. 0 .&&. e .==. 1) $ do
example1 (q, a, b, c)
example1 (q, a, b, c)
example1 (q, a, b, c)
return (q, a, b, c, d, e)
main = print_simple Preview example3