Questions tagged [typeclasses]

For questions about the ad-hoc parametric polymorphism feature typeclasses, as found in Haskell. Do not use for questions only about types, classes, or class types.

Filter by
Sorted by
Tagged with
1 vote
1 answer
158 views

Implementing automatic derivation without macros?

In Rust: #[derive(Display)] struct Foo<T>(T); If T conforms to the Display trait, ...
Jw C's user avatar
  • 131
11 votes
1 answer
478 views

Typeclasses, traits, interfaces, protocols: is there any consistent terminology?

Many languages have some form of expressing "user-defined duck typing": defining a type by its behavior, rather than anything about the structure or data of an instance of the type itself. ...
apropos's user avatar
  • 927
10 votes
3 answers
559 views

What are the pros and cons of traits in comparison with interfaces?

In Rust, structs and enums may implement any number of traits, which specify certain functions. When a struct/enum implements a trait, this is where the functions are defined: ...
Rydwolf Programs's user avatar