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

Safe HaskellNone
LanguageHaskell2010

QIO.Heap

Description

This module contains the definition of a Type Class that represents a Heap. In the context of QIO, a Heap is the type used to represent a classical basis state. An instance of a Heap is also defined, that makes use of a Map.

Synopsis

Documentation

class Eq h => Heap h where Source #

The Heap Type Class

Minimal complete definition

initial, update, (?), forget

Methods

initial :: h Source #

define an initial (i.e. empty) Heap

update :: h -> Qbit -> Bool -> h Source #

update the value of a Qubit within the Heap to the given Boolen value

(?) :: h -> Qbit -> Maybe Bool Source #

Lookup the value of the given Qubit in the Heap (if it exists)

forget :: h -> Qbit -> h Source #

remove the given Qubit from the Heap

hswap :: h -> Qbit -> Qbit -> h Source #

Swap the values associated with two Qubits within the Heap

Instances

Heap HeapMap Source #

A HeapMap is an instance of the Heap type class, where the Heap functions can make use of the underlying Map functions.

type HeapMap = Map Qbit Bool Source #

HeapMap is simply a type synonym for a Map from Qubits to Boolean values