diff mbox series

[bug#38596] gnu: Add PureScript.

Message ID 87sggb2rn1.fsf@asu.edu
State Accepted
Headers show
Series [bug#38596] gnu: Add PureScript. | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job

Commit Message

John Soo May 8, 2020, 12:32 a.m. UTC
Hello,

Christopher Baines <mail@cbaines.net> writes:

> Some really minor description things I missed earlier:
>
> ghc-aeson-better-errors, ghc-transformers and ghc-websockets have URLs
> in the description, @url could probably be used.
>
> I'd also remove the following from the ghc-bower-json description, it
> reads more like uninformative advertising to me and isn't really
> relevant to this specific package:
>
>   Bower is a package manager for the web (see http://bower.io).

Done!

> Maybe it would be good to note why the package in Guix didn't work, like
> I tried to use ghc-happy@1.19.12, and the build phase failed with some
> type errors. That'll at least point out clearly that there's an
> incompatability. I don't think much detail is needed, the following
> would be fine.
>
>      `(("ghc-happy" ,ghc-happy-1.19.9)  ; build fails with 1.19.12

Done!

>> Ah thanks for the suggestion here. I found one that could be taken from
>> the existing package in (gnu packages haskell-xyz). The rest seemed to
>> be either pinned exactly or too strict to take from guix packages.
>
> Thanks, although my intent was more about adding something like this.
>
>   #:phases
>   (modify-phases %standard-phases
>     (add-after 'unpack 'patch
>       (lambda _
>         (substitute* "purescript.cabal"
>           (("clock .*$")
>            "clock,\n"))
>         #t)))))

With the addition of a patch I was able to relax most of the package
versions I introduced to ones we have. The final remaining required
dependency seems to be happy which I kept at 1.19.9.

> Now I'm not sure quite how risky this is, the purescript tests aren't
> being run, but given this is Haskell and it compiles, hopefully that
> provides some guarantees.
>
> What do you think?

My only caveat too is now I have not really tested this version. I had
done some work with a prior version.  I wish I could run the tests but
they seem to rely heavily on npm and bower.

Thanks again,

John

Comments

Christopher Baines May 8, 2020, 9:13 a.m. UTC | #1
John Soo <jsoo1@asu.edu> writes:

> Christopher Baines <mail@cbaines.net> writes:
>
>> Some really minor description things I missed earlier:
>>
>> ghc-aeson-better-errors, ghc-transformers and ghc-websockets have URLs
>> in the description, @url could probably be used.
>>
>> I'd also remove the following from the ghc-bower-json description, it
>> reads more like uninformative advertising to me and isn't really
>> relevant to this specific package:
>>
>>   Bower is a package manager for the web (see http://bower.io).
>
> Done!
>
>> Maybe it would be good to note why the package in Guix didn't work, like
>> I tried to use ghc-happy@1.19.12, and the build phase failed with some
>> type errors. That'll at least point out clearly that there's an
>> incompatability. I don't think much detail is needed, the following
>> would be fine.
>>
>>      `(("ghc-happy" ,ghc-happy-1.19.9)  ; build fails with 1.19.12
>
> Done!
>
>>> Ah thanks for the suggestion here. I found one that could be taken from
>>> the existing package in (gnu packages haskell-xyz). The rest seemed to
>>> be either pinned exactly or too strict to take from guix packages.
>>
>> Thanks, although my intent was more about adding something like this.
>>
>>   #:phases
>>   (modify-phases %standard-phases
>>     (add-after 'unpack 'patch
>>       (lambda _
>>         (substitute* "purescript.cabal"
>>           (("clock .*$")
>>            "clock,\n"))
>>         #t)))))
>
> With the addition of a patch I was able to relax most of the package
> versions I introduced to ones we have. The final remaining required
> dependency seems to be happy which I kept at 1.19.9.

Awesome. I added the patch to the list in gnu/local.mk, which I think is
necessary when building the guix package for guix at least. I also added
a small comment to the top of the patch.

>> Now I'm not sure quite how risky this is, the purescript tests aren't
>> being run, but given this is Haskell and it compiles, hopefully that
>> provides some guarantees.
>>
>> What do you think?
>
> My only caveat too is now I have not really tested this version. I had
> done some work with a prior version.  I wish I could run the tests but
> they seem to rely heavily on npm and bower.

Personally, I think that's fine for the moment. It builds at least and I
can run purs to at least get the help.

I've gone ahead and pushed these patches as
de488b3a5fff4535471f6706da03e1b74e6a37fd, thanks for all your work!

Chris
diff mbox series

Patch

From 474b6af6dbd79a8c93a457b99d1465d6e9ede306 Mon Sep 17 00:00:00 2001
From: John Soo <jsoo1@asu.edu>
Date: Fri, 13 Dec 2019 09:21:50 -0800
Subject: [PATCH 17/17] gnu: Add purescript.

* gnu/packages/purescript.scm (purescript): New variable.
* gnu/packages/patches/purescript-relax-dependencies.patch: Relax cabal dependencies.
---
 .../purescript-relax-dependencies.patch       | 39 ++++++++
 gnu/packages/purescript.scm                   | 89 +++++++++++++++++++
 2 files changed, 128 insertions(+)
 create mode 100644 gnu/packages/patches/purescript-relax-dependencies.patch

diff --git a/gnu/packages/patches/purescript-relax-dependencies.patch b/gnu/packages/patches/purescript-relax-dependencies.patch
new file mode 100644
index 0000000000..4571fea654
--- /dev/null
+++ b/gnu/packages/patches/purescript-relax-dependencies.patch
@@ -0,0 +1,39 @@ 
+diff --git purescript-0.13.6/purescript.cabal purescript-0.13.6/purescript.cabal.orig
+index 7e38070..0724a0b 100644
+--- purescript-0.13.6/purescript.cabal
++++ purescript-0.13.6/purescript.cabal.orig
+@@ -1167,1 +1167,1 @@ library
+-        Glob ==0.9.*,
++        Glob ==0.10.*,
+@@ -1171,1 +1171,1 @@ library
+-        ansi-terminal >=0.7.1 && <0.9,
++        ansi-terminal ==0.9.*,
+@@ -1180,1 +1180,1 @@ library
+-        clock <0.8,
++        clock ==0.8.*,
+@@ -1246,1 +1246,1 @@ executable purs
+-        Glob ==0.9.*,
++        Glob ==0.10.*,
+@@ -1250,1 +1250,1 @@ executable purs
+-        ansi-terminal >=0.7.1 && <0.9,
++        ansi-terminal ==0.9.*,
+@@ -1260,1 +1260,1 @@ executable purs
+-        clock <0.8,
++        clock ==0.8.*,
+@@ -1281,1 +1281,1 @@ executable purs
+-        network >=3.0.1.1 && <3.1,
++        network >=2.8 && <3.1,
+@@ -1358,1 +1358,1 @@ test-suite tests
+-        Glob ==0.9.*,
++        Glob ==0.10.*,
+@@ -1363,1 +1363,1 @@ test-suite tests
+-        ansi-terminal >=0.7.1 && <0.9,
++        ansi-terminal ==0.9.*,
+@@ -1372,1 +1372,1 @@ test-suite tests
+-        clock <0.8,
++        clock ==0.8.*,
+@@ -1384,2 +1384,2 @@ test-suite tests
+-        hspec <2.7,
+-        hspec-discover <2.7,
++        hspec ==2.7.*,
++        hspec-discover ==2.7.*,
diff --git a/gnu/packages/purescript.scm b/gnu/packages/purescript.scm
index 244fe0ed7d..13cd773839 100644
--- a/gnu/packages/purescript.scm
+++ b/gnu/packages/purescript.scm
@@ -17,6 +17,7 @@ 
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages purescript)
+  #:use-module (gnu packages)
   #:use-module (gnu packages haskell-xyz)
   #:use-module (gnu packages haskell-check)
   #:use-module (gnu packages haskell-crypto)
@@ -42,3 +43,91 @@ 
        (sha256
         (base32
          "138xpxdb7x62lpmgmb6b3v3vgdqqvqn4273jaap3mjmc2gla709y"))))))
+
+(define-public purescript
+  (package
+    (name "purescript")
+    (version "0.13.6")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "mirror://hackage/package/purescript/purescript-"
+             version
+             ".tar.gz"))
+       (sha256
+        (base32
+         "1xss3wpv6wb38gsh9r635s09cxzmiz81hhssdxzdba2pw6ifzx8j"))
+       (patches (search-patches "purescript-relax-dependencies.patch"))))
+    (build-system haskell-build-system)
+    (inputs
+     `(("ghc-glob" ,ghc-glob)
+       ("ghc-aeson" ,ghc-aeson)
+       ("ghc-aeson-better-errors" ,ghc-aeson-better-errors)
+       ("ghc-aeson-pretty" ,ghc-aeson-pretty)
+       ("ghc-ansi-terminal" ,ghc-ansi-terminal)
+       ("ghc-base-compat" ,ghc-base-compat)
+       ("ghc-blaze-html" ,ghc-blaze-html)
+       ("ghc-bower-json" ,ghc-bower-json)
+       ("ghc-boxes" ,ghc-boxes)
+       ("ghc-cheapskate" ,ghc-cheapskate)
+       ("ghc-clock" ,ghc-clock)
+       ("ghc-cryptonite" ,ghc-cryptonite)
+       ("ghc-data-ordlist" ,ghc-data-ordlist)
+       ("ghc-dlist" ,ghc-dlist)
+       ("ghc-edit-distance" ,ghc-edit-distance)
+       ("ghc-file-embed" ,ghc-file-embed)
+       ("ghc-fsnotify" ,ghc-fsnotify)
+       ("ghc-happy" ,ghc-happy)
+       ("ghc-language-javascript" ,ghc-language-javascript)
+       ("ghc-lifted-async" ,ghc-lifted-async)
+       ("ghc-lifted-base" ,ghc-lifted-base)
+       ("ghc-memory" ,ghc-memory)
+       ("ghc-microlens-platform" ,ghc-microlens-platform)
+       ("ghc-monad-control" ,ghc-monad-control)
+       ("ghc-monad-logger" ,ghc-monad-logger)
+       ("ghc-network" ,ghc-network)
+       ("ghc-parallel" ,ghc-parallel)
+       ("ghc-pattern-arrows" ,ghc-pattern-arrows)
+       ("ghc-protolude" ,ghc-protolude)
+       ("ghc-regex-tdfa" ,ghc-regex-tdfa)
+       ("ghc-safe" ,ghc-safe)
+       ("ghc-scientific" ,ghc-scientific)
+       ("ghc-semialign" ,ghc-semialign)
+       ("ghc-semigroups" ,ghc-semigroups)
+       ("ghc-sourcemap" ,ghc-sourcemap)
+       ("ghc-split" ,ghc-split)
+       ("ghc-stringsearch" ,ghc-stringsearch)
+       ("ghc-syb" ,ghc-syb)
+       ("ghc-these" ,ghc-these)
+       ("ghc-transformers-base" ,ghc-transformers-base)
+       ("ghc-transformers-compat" ,ghc-transformers-compat)
+       ("ghc-unordered-containers" ,ghc-unordered-containers)
+       ("ghc-utf8-string" ,ghc-utf8-string)
+       ("ghc-vector" ,ghc-vector)
+       ("ghc-ansi-wl-pprint" ,ghc-ansi-wl-pprint)
+       ("ghc-http-types" ,ghc-http-types)
+       ("ghc-network" ,ghc-network)
+       ("ghc-optparse-applicative" ,ghc-optparse-applicative)
+       ("ghc-wai" ,ghc-wai)
+       ("ghc-wai-websockets" ,ghc-wai-websockets)
+       ("ghc-warp" ,ghc-warp)
+       ("ghc-websockets" ,ghc-websockets)))
+    (native-inputs
+     `(("ghc-happy" ,ghc-happy-1.19.9) ; build fails with 1.19.12
+       ("ghc-hunit" ,ghc-hunit)
+       ("ghc-hspec" ,ghc-hspec)
+       ("hspec-discover" ,hspec-discover)
+       ("ghc-tasty" ,ghc-tasty)
+       ("ghc-tasty-golden" ,ghc-tasty-golden)
+       ("ghc-tasty-hspec" ,ghc-tasty-hspec)))
+    (arguments
+     `(;; Tests require npm
+       #:tests? #f
+       #:configure-flags '("--flags=release")))
+    (home-page "https://www.purescript.org/")
+    (synopsis "Haskell inspired programming language compiling to JavaScript")
+    (description
+     "Purescript is a small strongly, statically typed programming language with
+expressive types, inspired by Haskell and compiling to JavaScript.")
+    (license license:bsd-3)))
-- 
2.26.2