use open_hypergraphs::lax::var;
#[derive(PartialEq, Clone, Debug)]
pub struct Bit;
#[derive(PartialEq, Clone, Debug)]
pub enum Gate {
Copy,
And,
}
impl var::HasVar for Gate {
fn var() -> Gate {
Gate::Copy
}
}
impl var::HasBitAnd<Bit, Gate> for Gate {
fn bitand(_: Bit, _: Bit) -> (Bit, Gate) {
(Bit, Gate::And)
}
}
use hypersyn::def_arrow;
#[def_arrow(Bit, Gate, and_arrow)]
fn and(a: var!(Bit), b: var!(Bit)) -> (var!(Bit), var!(Bit)) {
(a.clone(), a & b)
}
fn main() {
println!("{:?}", and_arrow());
}