guix: import: stackage: Fix JSON accessors.
* guix/import/stackage.scm (lts-info-ghc-version, lst-info-packages): Use assoc-ref for accessing parsed JSON.
This commit is contained in:
		
							parent
							
								
									bb6419f374
								
							
						
					
					
						commit
						127586adfb
					
				
					 1 changed files with 4 additions and 7 deletions
				
			
		| 
						 | 
					@ -43,15 +43,12 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define (lts-info-ghc-version lts-info)
 | 
					(define (lts-info-ghc-version lts-info)
 | 
				
			||||||
  "Retruns the version of the GHC compiler contained in LTS-INFO."
 | 
					  "Retruns the version of the GHC compiler contained in LTS-INFO."
 | 
				
			||||||
  (match lts-info
 | 
					  (and=> (assoc-ref lts-info "snapshot")
 | 
				
			||||||
    ((("snapshot" ("ghc" . version) _ _) _)  version)
 | 
					         (cut assoc-ref <> "ghc")))
 | 
				
			||||||
    (_ #f)))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define (lts-info-packages lts-info)
 | 
					(define (lts-info-packages lts-info)
 | 
				
			||||||
  "Returns the alist of packages contained in LTS-INFO."
 | 
					  "Retruns the alist of packages contained in LTS-INFO."
 | 
				
			||||||
  (match lts-info
 | 
					  (or (assoc-ref lts-info "packages") '()))
 | 
				
			||||||
    ((("packages" pkg ...) . _) pkg)
 | 
					 | 
				
			||||||
    (_ '())))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define (leave-with-message fmt . args)
 | 
					(define (leave-with-message fmt . args)
 | 
				
			||||||
  (raise (condition (&message (message (apply format #f fmt args))))))
 | 
					  (raise (condition (&message (message (apply format #f fmt args))))))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue