If we were to create a Rust version of this page for Haskell, what cool programming techniques would you add to it?

  • Ephera
    link
    fedilink
    arrow-up
    5
    ·
    3 hours ago

    This works with anything that one might call “named tuples”.

    So, you can also define a struct like so and it’ll work:

    struct Baz(i32);
    

    On the other hand, if you define an enum variant with the normal struct syntax, it does not work:

    enum Foo {
        ...
        Qux { something: i32 } //cannot omit braces
    }
    
    • barsoap@lemm.ee
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      1 hour ago

      Named function arguments would occasionally be nice to have instead of the single n-tuple they take now. Currently I’m more or less playing a game of "can I name my local variables such that rust-analyzer won’t display the argument name when I stick them into functions (because they’re called the same)).