It would be kind of neat to be able to bridge traits and type classes. My needs are currently met without that, but I could imagine that trait objects can be safely passed between Rust and haskell. Unfortunately, generics, as-is, cannot be, since it's impossible to prove which possible instantiations they have.
But an example might be:
trait Foo {
fn foo(&self);
}
struct Bar {
pub fn bar(&self, foo: &dyn Foo);
}
and have that emit something like
class Foo a where
foo :: a -> IO ()
data SomeFoo = forall a. Foo a => SomeFoo a
data Bar
bar :: Bar -> SomeFoo -> IO ()
I'm still a little befuddled as to whether this is the right approach or not.
It would be kind of neat to be able to bridge
traits andtype classes. My needs are currently met without that, but I could imagine that trait objects can be safely passed between Rust and haskell. Unfortunately, generics, as-is, cannot be, since it's impossible to prove which possible instantiations they have.But an example might be:
and have that emit something like
I'm still a little befuddled as to whether this is the right approach or not.