QIO-1.3: The Quantum IO Monad is a library for defining quantum computations in Haskell

Safe HaskellNone
LanguageHaskell2010

QIO.Qdata

Description

This module defines a type class for quantum data types, as well as some instances of this class for pairs, lists, and quantum integers

Synopsis

Documentation

class Qdata a qa | a -> qa, qa -> a where Source #

The Qdata type class defines the operation a quantum datatype must implement.

Minimal complete definition

mkQ, measQ, letU, condQ

Methods

mkQ :: a -> QIO qa Source #

measQ :: qa -> QIO a Source #

letU :: a -> (qa -> U) -> U Source #

condQ :: qa -> (a -> U) -> U Source #

Instances

Qdata Bool Qbit Source #

The lowest-level instance of Qdata is the relation between Booleans and Qubits.

Methods

mkQ :: Bool -> QIO Qbit Source #

measQ :: Qbit -> QIO Bool Source #

letU :: Bool -> (Qbit -> U) -> U Source #

condQ :: Qbit -> (Bool -> U) -> U Source #

Qdata Int QInt Source #

quantum integers form a quantum data type, relating them to the classical Haskell Int type.

Methods

mkQ :: Int -> QIO QInt Source #

measQ :: QInt -> QIO Int Source #

letU :: Int -> (QInt -> U) -> U Source #

condQ :: QInt -> (Int -> U) -> U Source #

Qdata a qa => Qdata [a] [qa] Source #

A list of quantum data is also a quantum data type

Methods

mkQ :: [a] -> QIO [qa] Source #

measQ :: [qa] -> QIO [a] Source #

letU :: [a] -> ([qa] -> U) -> U Source #

condQ :: [qa] -> ([a] -> U) -> U Source #

(Qdata a qa, Qdata b qb) => Qdata (a, b) (qa, qb) Source #

A pair of quantum data types is itself a quantum data type.

Methods

mkQ :: (a, b) -> QIO (qa, qb) Source #

measQ :: (qa, qb) -> QIO (a, b) Source #

letU :: (a, b) -> ((qa, qb) -> U) -> U Source #

condQ :: (qa, qb) -> ((a, b) -> U) -> U Source #

condQRec :: Qdata a qa => [qa] -> [a -> U] -> U Source #

A recursive conditional on a list of quantum data

qIntSize :: Int Source #

Quantum integers are of a fixed length, which is defined by this constant. Currently, this is set to 4.

newtype QInt Source #

A Quantum integer is a wrapper around a fixed-length list of qubits

Constructors

QInt [Qbit] 

Instances

Show QInt Source # 

Methods

showsPrec :: Int -> QInt -> ShowS #

show :: QInt -> String #

showList :: [QInt] -> ShowS #

Qdata Int QInt Source #

quantum integers form a quantum data type, relating them to the classical Haskell Int type.

Methods

mkQ :: Int -> QIO QInt Source #

measQ :: QInt -> QIO Int Source #

letU :: Int -> (QInt -> U) -> U Source #

condQ :: QInt -> (Int -> U) -> U Source #

int2bits :: Int -> [Bool] Source #

Convert an integer to a list of Booleans

bits2int :: [Bool] -> Int Source #

Convert a list of Booleans to an integer