We need to be able to define new Traits. Haskell's typeclass definition looks like:
class Show a where
show :: a -> String
There's a variety or reasons why I don't like this syntax.
Rust's trait definition looks like:
pub trait Summary {
fn summarize(&self) -> String;
}
This is closer to what I want (but obviously pub goes away and &self should (not be borrowed) and have a better name like object or something. And I don't like the fn keyword either.
Perhaps something like this:
trait Summary {
summarize : a -> String
}
We need to be able to define new Traits. Haskell's typeclass definition looks like:
There's a variety or reasons why I don't like this syntax.
Rust's trait definition looks like:
This is closer to what I want (but obviously
pubgoes away and&selfshould (not be borrowed) and have a better name likeobjector something. And I don't like thefnkeyword either.Perhaps something like this: