Subject: Re: [bug#51655] [PATCH] build-system: haskell: Add ‘package-with-explicit-haskell’ procedure.

From: Lars-Dominik Braun <[email-masked]>
Date: Fri, 12 Nov 2021 11:34:11 +0100

Hi,

I’ve tested the patch with the snippet below and it builds most
packages fine, until it hits a type error and aborts. This is probably
expected, since not all packages are compatible with multiple GHC
versions.

The code looks fine, since it’s just moving the Python-specific code to
(guix packages).  I don’t feel qualified enough to say whether the new
API in (guix packages) is welcome or not though. Anyone? Maybe it’d
be worth having a common parameter for all build systems?

---
(use-modules (guix build-system haskell)
             (gnu packages finance))

(define (default-haskell-8.8)
  ;; Lazily resolve the binding to avoid a circular dependency.
  (let ((haskell (resolve-interface '(gnu packages haskell))))
    (module-ref haskell 'ghc-8.8)))

(define package-with-haskell-8.8
  (package-with-explicit-haskell (delay (default-haskell-8.8))
                                 "ghc-" "ghc-8.8-"
                                 #:variant-property 'ghc-8.8-variant))

(package-with-haskell-8.8 hledger)
---

Cheers,
Lars