diff mbox series

[bug#37717,1/3] gnu: Add ghc-atomic-primops.

Message ID d20fc9b1-7886-4517-9440-a1b5a34f1f87@www.fastmail.com
State Accepted
Headers show
Series gnu: Add kmonad. | expand

Commit Message

Alex Griffin Oct. 12, 2019, 7:33 p.m. UTC

Comments

Marius Bakke Oct. 18, 2019, 6:23 p.m. UTC | #1
"Alex Griffin" <a@ajgrf.com> writes:

> From 77ff329dd34d307f19629086baf44c1623858fa1 Mon Sep 17 00:00:00 2001
> From: Alex Griffin <a@ajgrf.com>
> Date: Sat, 12 Oct 2019 13:34:43 -0500
> Subject: [PATCH 1/3] gnu: Add ghc-atomic-primops.
>
> * gnu/packages/haskell-xyz.scm (ghc-atomic-primops): New variable.

[...]

> diff --git a/gnu/packages/haskell-xyz.scm b/gnu/packages/haskell-xyz.scm
> index 2977398880..37df2ed909 100644
> --- a/gnu/packages/haskell-xyz.scm
> +++ b/gnu/packages/haskell-xyz.scm
> @@ -381,6 +382,31 @@ over threads in Haskell, in which @code{Async a} is a concurrent thread that
>  will eventually deliver a value of type @code{a}.")
>      (license license:bsd-3)))
>  
> +(define-public ghc-atomic-primops
> +  (package
> +    (name "ghc-atomic-primops")
> +    (version "0.8.3")

Note: we follow the Stackage LTS versions for GHC 7.4, currently 12.26.
So I think we should take version 0.8.2 instead:

https://www.stackage.org/lts-12.26/package/atomic-primops-0.8.2

(hopefully Timothy or someone can correct me if I'm wrong here)

> +    (source
> +     (origin
> +       (method url-fetch)
> +       (uri (string-append
> +             "https://hackage.haskell.org/package/atomic-primops/atomic-primops-"
> +             version
> +             ".tar.gz"))

Can you align these lines a bit?

> +       (sha256
> +        (base32
> +         "03n5dmyplrqgbyf8dr91izkxci7gkl3i3fnp82i5ld869zrgjfh0"))))
> +    (build-system haskell-build-system)
> +    (inputs `(("ghc-primitive" ,ghc-primitive)))
> +    (home-page "https://github.com/rrnewton/haskell-lockfree/wiki")
> +    (synopsis "Safe approach to CAS and other atomic ops")
> +    (description
> +     "After GHC 7.4 a new @code{casMutVar#} primop became available, but it's
> +difficult to use safely, because pointer equality is a highly unstable property
> +in Haskell.  This library provides a safer method based on the concept of
> +@code{Ticket}s.")

Can you try to adjust the first sentence so that it reads better?
Perhaps something along the lines of "GHC 7.4 introduced a new
@code{casMutVar#} PrimOp which is difficult to use safely, because ...".
diff mbox series

Patch

From 77ff329dd34d307f19629086baf44c1623858fa1 Mon Sep 17 00:00:00 2001
From: Alex Griffin <a@ajgrf.com>
Date: Sat, 12 Oct 2019 13:34:43 -0500
Subject: [PATCH 1/3] gnu: Add ghc-atomic-primops.

* gnu/packages/haskell-xyz.scm (ghc-atomic-primops): New variable.
---
 gnu/packages/haskell-xyz.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/haskell-xyz.scm b/gnu/packages/haskell-xyz.scm
index 2977398880..37df2ed909 100644
--- a/gnu/packages/haskell-xyz.scm
+++ b/gnu/packages/haskell-xyz.scm
@@ -21,6 +21,7 @@ 
 ;;; Copyright © 2019 Jacob MacDonald <jaccarmac@gmail.com>
 ;;; Copyright © 2019 John Soo <jsoo1@asu.edu>
 ;;; Copyright © 2019 Kyle Meyer <kyle@kyleam.com>
+;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -381,6 +382,31 @@  over threads in Haskell, in which @code{Async a} is a concurrent thread that
 will eventually deliver a value of type @code{a}.")
     (license license:bsd-3)))
 
+(define-public ghc-atomic-primops
+  (package
+    (name "ghc-atomic-primops")
+    (version "0.8.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://hackage.haskell.org/package/atomic-primops/atomic-primops-"
+             version
+             ".tar.gz"))
+       (sha256
+        (base32
+         "03n5dmyplrqgbyf8dr91izkxci7gkl3i3fnp82i5ld869zrgjfh0"))))
+    (build-system haskell-build-system)
+    (inputs `(("ghc-primitive" ,ghc-primitive)))
+    (home-page "https://github.com/rrnewton/haskell-lockfree/wiki")
+    (synopsis "Safe approach to CAS and other atomic ops")
+    (description
+     "After GHC 7.4 a new @code{casMutVar#} primop became available, but it's
+difficult to use safely, because pointer equality is a highly unstable property
+in Haskell.  This library provides a safer method based on the concept of
+@code{Ticket}s.")
+    (license license:bsd-3)))
+
 (define-public ghc-atomic-write
   (package
     (name "ghc-atomic-write")
-- 
2.23.0