guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#30657] [PATCH 2/4] gexp: Add 'file-like?'.


From: Clément Lassieur
Subject: [bug#30657] [PATCH 2/4] gexp: Add 'file-like?'.
Date: Sat, 03 Mar 2018 02:44:22 +0100
User-agent: mu4e 1.0; emacs 25.3.1

Ludovic Courtès <address@hidden> writes:

>> +(define (file-like? object)
>> +  (or (local-file? object)
>> +      (plain-file? object)
>> +      (computed-file? object)
>> +      (program-file? object)
>> +      (scheme-file? object)
>> +      (file-append? object)))
>
> This procedure would miss new types added with ‘define-gexp-compiler’.
>
> In fact I think you can simply write:
>
>   (define file-like? (@@ (guix gexp) lookup-compiler))
>
> Does that make sense?

Yes it's great!  One also needs to check that it's a struct though.  I
put it in (gnu services configuration).  Would it make sense to add the
'struct?' check in (guix gexp), or to add 'file-like?' there?

Clément





reply via email to

[Prev in Thread] Current Thread [Next in Thread]