Great article. Rust struct and Haskell records work pretty much the same way, too: // Rust Item { name, price } Item { name: name, price: price } match item { Item { name, .. } => todo!(), } corresponding to -- Haskell Item { item, price } Item { item = item, price = price } case item of Item { name, .. } -> undefined Haskell has some opt-in flexibility wrt. packing and unpacking of field names [1]. [1]: https://ghc.…
// rust
let Item { name, .. } = item;
-- haskell
let Item { name } = item in …
(Note: the haskell version requires NamedFieldPuns, or RecordWildCards for something like Rust’s version)