This is an implementation of the languages , , and and all related constructions, described in the paper Quantum Information Effects by Chris Heunen and Robin Kaarsgaard.
This directory contains the implementation of the constructions and translations relating to , , and . These languages are implemented as eDSLs in (heavily extended Glasgow) Haskell. They have been tested to work with the GHC Haskell compilation system version 8.10.1 on macOS 11.6 Big Sur, as well as 8.6.5 on Ubuntu 20.04.
Though Haskell supports arrows via the Arrow
type class, the implementation in Haskell only permits arrows over Haskell functions (i.e., over the type a -> b
) rather than over an arbitrary Category
instance. For this reason, though the and constructions are arrows, they cannot be implemented as such. Instead, we have chosen to name the arrow combinators with suggestive but non-conflicting names, such as arr'
, first'
, left'
, and so forth.
This repository is structured as follows:
UPiBase.hs
: Contains the data type declaration for combinators.UPi.hs
: Implementation of all (derived) combinators, including the quantum gates described in Section 3.2.UPiaBase.hs
: Contains the data type declaration for combinators, as well as the declaration of the type classesCloneable
andInhabited
used to define theclone
andinhab
combinators respectively. Since all types have aCloneable
instance, theCloneable
constraint is trivial (but Haskell doesn't know that).UPia.hs
: Contains the implementation of all (derived) combinators of , as described in Section 3.3.UPichiaBase.hs
: Contains the data type declaration for combinators, as well as the declaration of theDiscardable
type class used to handle projections. Again, all types haveDiscardable
instances, so the constraint is trivial, but Haskell doesn't know that.UPichia.hs
: Contains the implementation of all (derived) combinators relating to , see Section 3.4.QFC.hs
: Contains the translation from quantum flow charts to as described in Section 6.2.
- In the paper, a straightforward way of deriving
Inhabited b+b'
fromInhabited b'
is described. However, this is not implemented due to overlap with the instance derivingInhabited b+b'
fromInhabited b
.