Subject: Re: [bug#49606] [PATCH wip-haskell v2] gnu: Add ghc-8.10.

From: Xinglu Chen <[email-masked]>
Date: Mon, 13 Sep 2021 18:07:26 +0200

On Mon, Sep 13 2021, Lars-Dominik Braun wrote:

> Hi,
>
>> Any comments/thoughts on this, anyone?
> I looked at the patch and would like to propose minor modifications. In
> particular I
>
> - removed the 'fix-cc-name phase, which is inherited from ghc-8.8 anyway

Aye, the patch has bitrotted a bit.

> - converted the failing test (which I can’t get to pass either) into
>   an expected failure instead of nulling it out and

Either way works for me.  :-)

> - renamed the package to ghc-next, which should avoid
>   https://issues.guix.gnu.org/47335 – if we also rename GHC 8.8 in a
>   different patch.

AFAIK, ‘-next’ packages are usually unstable versions of the regular
version, e.g., ‘emacs-next’ and ‘guile-next’.  ‘ghc-8.10’ is a stable
release, so I am not sure if the ‘-next’ prefix is appropriate.

Also, I would imagine that other language ecosystems also have to
problem of the default compiler not being the latest version, e.g., the
‘rust’ package points to rust-1.45, but rust-1.52 is the latest
available version.

> I think we can merge this patch to master, since it only adds a new GHC
> version and has no further implications. Thoughts?

Originally, the plan was to apply this patch to the ‘wip-haskell’
branch, which contained a patch that results in rebuilding all Haskell
pacakges, and then update our Stackage LTS version (which hasn’t been
updated for ~2 years)[1].  But seeing as there isn’t much interest in a
Haskell update, applying to ‘master’ seems like a better idea.

[1]:
<https://yhetil.org/guix/e7BRZzcL_m4HQVFynEoJhiwl7-MNGGeVEXrXExHAjPuEl9KtiGsySm7YY5sQ4evmx_O3V1mhFq_p3PafWbCKy9t5_0gfR2I2IJCmV8JTryY=@protonmail.com/>

> diff --git a/gnu/packages/haskell.scm b/gnu/packages/haskell.scm
> index 3d10bdc946..ca0498e6d9 100644
> --- a/gnu/packages/haskell.scm
> +++ b/gnu/packages/haskell.scm
> @@ -21,6 +21,7 @@
>  ;;; Copyright © 2019 Jacob MacDonald <[email-masked]>
>  ;;; Copyright © 2020 Marius Bakke <[email-masked]>
>  ;;; Copyright © 2021 Matthew James Kraai <[email-masked]>
> +;;; Copyright © 2021 Xinglu Chen <[email-masked]>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -663,6 +664,60 @@ interactive environment for the functional language Haskell.")
>                                  (file-pattern ".*\\.conf\\.d$")
>                                  (file-type 'directory))))))
>  
> +(define-public ghc-8.10
> +  (package
> +    (inherit ghc-8.8)
> +    (name "ghc-next")
> +    (version "8.10.7")
> +    (source
> +     (origin
> +       (method url-fetch)
> +       (uri (string-append "https://www.haskell.org/ghc/dist/"
> +                           version "/ghc-" version "-src.tar.xz"))
> +       (sha256
> +        (base32 "179ws2q0dinl1a39wm9j37xzwm84zfz3c5543vz8v479khigdvp3"))))
> +    (native-inputs
> +     `(("ghc-bootstrap" ,ghc-8.8)
> +       ("ghc-testsuite"
> +        ,(origin
> +           (method url-fetch)
> +           (uri (string-append
> +                 "https://www.haskell.org/ghc/dist/"
> +                 version "/ghc-" version "-testsuite.tar.xz"))
> +           (patches (search-patches "ghc-testsuite-dlopen-pie.patch"))
> +           (sha256
> +            (base32
> +             "1zl25gg6bpx5601k8h3cqnns1xfc0nqgwnh8jvn2s65ra3f2g1nz"))))
> +       ("git" ,git-minimal)                     ; invoked during tests
> +       ,@(filter (match-lambda
> +                   (("ghc-bootstrap" . _) #f)
> +                   (("ghc-testsuite" . _) #f)
> +                   (_ #t))
> +                 (package-native-inputs ghc-8.8))))
> +    (arguments
> +     (substitute-keyword-arguments (package-arguments ghc-8.8)
> +       ((#:phases phases '%standard-phases)
> +        `(modify-phases ,phases
> +           (add-after 'unpack-testsuite 'patch-more-shebangs
> +             (lambda* (#:key inputs #:allow-other-keys)
> +               (let ((bash (assoc-ref inputs "bash")))
> +                 (substitute* '("testsuite/tests/driver/T8602/T8602.script")
> +                   (("/bin/sh")
> +                    (string-append bash "/bin/sh"))))))
> +           ;; Mark failing tests as broken. Reason for failure is unknown.
> +           (add-after 'skip-more-tests 'skip-even-more-tests
> +             (lambda _
> +               (substitute* '("testsuite/tests/driver/T16521/all.T")
> +                 (("extra_files" all) (string-append "[" all))
> +                 (("\\]\\), " all)
> +                  (string-append all "expect_broken(0)], ")))))))))
> +    (native-search-paths (list (search-path-specification
> +                                (variable "GHC_PACKAGE_PATH")
> +                                (files (list
> +                                        (string-append "lib/ghc-" version)))
> +                                (file-pattern ".*\\.conf\\.d$")
> +                                (file-type 'directory))))))
> +

The updated patch LGTM, and great that you updated it to 8.10.7!