moniker/
binder.rs

1use std::fmt;
2
3use free_var::FreeVar;
4
5#[derive(Debug, Clone, PartialEq, Eq, Hash)]
6pub struct Binder<N>(pub FreeVar<N>);
7
8impl<N: fmt::Display> fmt::Display for Binder<N> {
9    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
10        write!(f, "{}", self.0)
11    }
12}
13
14impl<N> PartialEq<FreeVar<N>> for Binder<N>
15where
16    N: PartialEq,
17{
18    fn eq(&self, other: &FreeVar<N>) -> bool {
19        self.0 == *other
20    }
21}
22
23impl<N> PartialEq<Binder<N>> for FreeVar<N>
24where
25    N: PartialEq,
26{
27    fn eq(&self, other: &Binder<N>) -> bool {
28        *self == other.0
29    }
30}