On Tue, Jul 14, 2026 at 08:05:53PM +0200, Hugo Buddelmeijer via Development of 
GNU Guix and the GNU System distribution. wrote:
> On 7/14/26 19:07, civodul wrote:
> 
> > +            <system76-power-configuration>
> > 
> > As a rule of thumb, we generally don't export record type descriptors 
> > <https://guix.gnu.org/manual/devel/en/html_node/Data-Types-and-Pattern- 
> > Matching.html>.
> 
> I experimented with creating better graphs[1] and my first attempt 
> failed miserably, because I started with a new `mygraph.scm` in which I 
> copied the `export-graph` procedure.  But that procedure looks like this:
> 
> (define* (export-graph  backend)
>    (match backend
>      (($ <graph-backend> _ _ emit-prologue emit-epilogue emit-node 
> emit-edge)
>       ...
> 
> and I could only make that work by exporting `<graph-backend>` in my 
> local guix clone.
> 
> Is there a way to write such a procedure that matches a record without 
> having it placed in the module that defines the record?

I actually think it is cleaner to not use the record matcher (since it
is constructor order dependent). You can use the "field" (i.e. procedure
result) and predicate matchers, `=` and `?`, to do it like this

```
(match record
  ((? my-record?
      (= my-record-field-a a)
      (= my-record-field-b b)
      ...)
   ...)
```

using the exported predicate and accessor procedures.

- Saku

Attachment: signature.asc
Description: PGP signature

  • How to matching g... Development of GNU Guix and the GNU System distribution.
    • Re: How to m... Saku Laesvuori
      • Re: How ... Development of GNU Guix and the GNU System distribution.

Reply via email to