Hello! I'm having trouble getting this this to type check:
impl <F: Fn(Exp) > Exp> From<F> for Circuit {
fn from(f: F) > Circuit {
Circuit {
inputs: vec![Var(0)],
output: f(Exp::wrap_var(Var(0)))
}
}
}
impl <F: Fn(Exp, Exp) > Exp> From<F> for Circuit where {
fn from(f: F) > Circuit {
Circuit {
inputs: vec![Var(0), Var(1)],
output: f(Exp::wrap_var(Var(0)), Exp::wrap_var(Var(1)))
}
}
}
This causes this error:
error[E0119]: conflicting implementations of trait `std::convert::From<_>` for type `ast::Circuit`:
> ast.rs:107:1

98  impl <F: Fn(Exp) > Exp> From<F> for Circuit {
 _ starting here...
99   fn from(f: F) > Circuit {
100   Circuit {
101   inputs: vec![Var(0)],
102   output: f(Exp::wrap_var(Var(0)))
103   }
104   }
105   }
 _ ...ending here: first implementation here
106 
107  impl <F: Fn(Exp, Exp) > Exp> From<F> for Circuit where {
 _^ starting here...
108   fn from(f: F) > Circuit {
109   Circuit {
110   inputs: vec![Var(0), Var(1)],
111   output: f(Exp::wrap_var(Var(0)), Exp::wrap_var(Var(1)))
112   }
113   }
114   }
 _^ ...ending here: conflicting implementation for `ast::Circuit`
I'm guessing this is because it could be possible for some type to implement both Fn(Exp, Exp) > Exp
and Fn(Exp) > Exp
at the same time. Is there any recommended workaround to this?