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

Safe HaskellSafe-Infered

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 whereSource

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

Methods

mkQ :: a -> QIO qaSource

measQ :: qa -> QIO aSource

letU :: a -> (qa -> U) -> USource

condQ :: qa -> (a -> U) -> USource

Instances

Qdata Bool Qbit

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

Qdata Int QInt

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

Qdata a qa => Qdata [a] [qa]

A list of quantum data is also a quantum data type

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

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

condQRec :: Qdata a qa => [qa] -> [a -> U] -> USource

A recursive conditional on a list of quantum data

qIntSize :: IntSource

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 
Qdata Int QInt

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

int2bits :: Int -> [Bool]Source

Convert an integer to a list of Booleans

bits2int :: [Bool] -> IntSource

Convert a list of Booleans to an integer