entangled-xyz / scotty

Quantum computing framework for Java and Scala developers.
https://www.entangled.xyz/scotty/
Apache License 2.0
24 stars 2 forks source link

Classical bits should be represented with a sum type #20

Closed vasinov closed 5 years ago

vasinov commented 5 years ago

To avoid error-handling logic in the classical register and collapsed state conversions we should represent classical bits with the following sum type:

sealed trait Bit
case class Zero extends Bit
case class One extends Bit

with appropriate Int to Bit conversions.