33
Extending Rust's Effect System (blog.yoshuawuyts.com)
you are viewing a single comment's thread
view the rest of the comments
[-] haskman@programming.dev 3 points 9 months ago

Yes, my thoughts exactly.

This problem is not solved by monads, but by higher kinded types in general in languages like Haskell. They give you a uniform way to be generic over effects like async (Async<A>) vs sync (Identity<A>). Both of these can be treated as (F<A>) for all A. So a generic Into would look like the following, and no special syntax or semantics would be needed. The type system (if sound) would prevent you from misusing a trait like this.

trait Into<F,T> {
   def into(self): F<T>;
}
this post was submitted on 11 Feb 2024
33 points (100.0% liked)

Rust

5966 readers
26 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS