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: Ludovic Courtès
Subject: [bug#30657] [PATCH 2/4] gexp: Add 'file-like?'.
Date: Fri, 02 Mar 2018 17:51:02 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Hello!

Clément Lassieur <address@hidden> skribis:

> * guix/gexp.scm (file-like?): New exported procedure.
> ---
>  guix/gexp.scm | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/guix/gexp.scm b/guix/gexp.scm
> index f005c4d29..9a30579a6 100644
> --- a/guix/gexp.scm
> +++ b/guix/gexp.scm
> @@ -1,5 +1,6 @@
>  ;;; GNU Guix --- Functional package management for GNU
>  ;;; Copyright © 2014, 2015, 2016, 2017 Ludovic Courtès <address@hidden>
> +;;; Copyright © 2018 Clément Lassieur <address@hidden>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -70,6 +71,8 @@
>              file-append-base
>              file-append-suffix
>  
> +            file-like?
> +
>              load-path-expression
>              gexp-modules
>  
> @@ -437,6 +440,14 @@ SUFFIX."
>                            (base   (expand base lowered output)))
>                       (string-append base (string-concatenate suffix)))))))
>  
> +(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?

Ludo’.





reply via email to

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