summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Sample <samplet@ngyro.com>2018-08-28 09:45:36 -0400
committerRicardo Wurmus <rekado@elephly.net>2018-10-01 12:12:08 +0200
commit127586adfb4228576d124ad5fa5cb6eacc29ea0f (patch)
tree6d04bd39f4d730320bb245e6f4eba1971bc65b56
parentbb6419f3745911aec87ad79c55bb953b36f246dd (diff)
downloadpatches-127586adfb4228576d124ad5fa5cb6eacc29ea0f.tar
patches-127586adfb4228576d124ad5fa5cb6eacc29ea0f.tar.gz
guix: import: stackage: Fix JSON accessors.
* guix/import/stackage.scm (lts-info-ghc-version, lst-info-packages): Use assoc-ref for accessing parsed JSON.
-rw-r--r--guix/import/stackage.scm11
1 files changed, 4 insertions, 7 deletions
diff --git a/guix/import/stackage.scm b/guix/import/stackage.scm
index afd5d997ae..1c1e73a723 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))))))