guix-commits
[Top][All Lists]
Advanced

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

04/257: guix: import: stackage: Fix JSON accessors.


From: Ricardo Wurmus
Subject: 04/257: guix: import: stackage: Fix JSON accessors.
Date: Thu, 27 Sep 2018 15:46:46 -0400 (EDT)

rekado pushed a commit to branch wip-haskell
in repository guix.

commit fc14ef886b2b349efc7fec487699039d8db52d70
Author: Timothy Sample <address@hidden>
Date:   Tue Aug 28 09:45:36 2018 -0400

    guix: import: stackage: Fix JSON accessors.
    
    * guix/import/stackage.scm (lts-info-ghc-version, lst-info-packages): Use
    assoc-ref for accessing parsed JSON.
---
 guix/import/stackage.scm | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/guix/import/stackage.scm b/guix/import/stackage.scm
index afd5d99..1c1e73a 100644
--- a/guix/import/stackage.scm
+++ b/guix/import/stackage.scm
@@ -43,15 +43,12 @@
 
 (define (lts-info-ghc-version lts-info)
   "Retruns the version of the GHC compiler contained in LTS-INFO."
-  (match lts-info
-    ((("snapshot" ("ghc" . version) _ _) _)  version)
-    (_ #f)))
+  (and=> (assoc-ref lts-info "snapshot")
+         (cut assoc-ref <> "ghc")))
 
 (define (lts-info-packages lts-info)
-  "Returns the alist of packages contained in LTS-INFO."
-  (match lts-info
-    ((("packages" pkg ...) . _) pkg)
-    (_ '())))
+  "Retruns the alist of packages contained in LTS-INFO."
+  (or (assoc-ref lts-info "packages") '()))
 
 (define (leave-with-message fmt . args)
   (raise (condition (&message (message (apply format #f fmt args))))))



reply via email to

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