Wish: Destructure Records in `let` bindings

When I import a dhall file, it is often a record with some symbols in it.

Right now, as far as I understand, I have to write

let lib = ./lib.dhall
in lib.List/map

or

let lib = ./lib.dhall
let List/map = lib.List/map
in List/map

Instead, what if we could split the record in the let binding itself:

let { List/map } = ./lib.dhall
in List/map

This would remove some unnecessary typing.
It corresponds to this Javascript snipppet:

{ foo } = someObject

See also Destructuring assignment

This feels related to Wish: Anonymous record arguments, maybe the let-Bindings and function bindings could share syntax for this.

This was theoretically supposed to get standardized, but I think work on it stagnated. Let binding pattern matching to unpack records · Issue #74 · dhall-lang/dhall-lang · GitHub

1 Like