You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this example partial_cmp is defined using cmp. But PartialOrd is a trait bound of Ord so we would need to define mutually recursive type class implementations in F* which is not possible.
Maybe this is not something we want to fix, the workaround for the example would be to not define partial_cmp using cmp and repeat the definition:
impl PartialOrd for W {
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
Some(self.0.cmp(&other.0))
}
}
And to avoid code duplication this can be reused in the definition of Ord:
impl Ord for W {
fn cmp(&self, other: &Self) -> core::cmp::Ordering {
self.partial_cmp(other).unwrap()
}
}
I mark this as bug because we shouldn't produce invalid F* code, we can decide to leave this as unsupported but then we should report an error.
The text was updated successfully, but these errors were encountered:
Open this code snippet in the playground
In this example
partial_cmp
is defined usingcmp
. ButPartialOrd
is a trait bound ofOrd
so we would need to define mutually recursive type class implementations in F* which is not possible.Maybe this is not something we want to fix, the workaround for the example would be to not define
partial_cmp
usingcmp
and repeat the definition:And to avoid code duplication this can be reused in the definition of
Ord
:I mark this as bug because we shouldn't produce invalid F* code, we can decide to leave this as unsupported but then we should report an error.
The text was updated successfully, but these errors were encountered: