1. 36
  1.  

  2. 12

    A very nice summary of the methods and goals of both languages, and some of the tradeoffs that get made to do them. They admit Rust is easier to write performant code in. They admit Haskell is easier to use for code requiring async, green threads or other sophisticated control-flow mongling. They admit both have a steep learning curve.

    I should probably write more Haskell in life!

    1. 3

      @bitemyapp I think you made a mistake with the Associated Type:

      class Hello a where
        type Return
        helloWorld :: a -> Return
      

      Associated Types must mention their type parameter right? So it’d have to look more like:

      class Hello a where
        type Return a
        helloWorld :: a -> Return a
      
      1. 1

        Yeah, fixed. Thanks!

      2. 2

        Approaching Rust from a Haskell-y angle, traits look superficially similar to Haskell typeclasses. However, if I remember/understand correctly, the lack of Higher Kinded Types in Rust prevents you from implementing a hierarchy of typeclasses like Functor, Applicative & Monad. Is this correct? I’d be interested in reading a more detailed explanation of the issue.

        1. 2

          It’s more complicated than that. Rust doesn’t have higher kinded types, but that isn’t exactly why something like Monad isn’t useful in Rust.

          Rust Traits can derive on top of other traits just like the hierarchy of type classes w/ Functor -> Applicative -> Monad.

          This thread goes into the details: https://twitter.com/withoutboats/status/1027702531361857536?lang=en

          This pertains to a particular application of Monad and monadic syntax, but it gets across why the problems are more particular than not having HKTs.