[PATCH 0/4] Functional programming? In my C++?! It's more likely than you think!

  • Done
  • quality assurance status badge
Details
3 participants
  • Liliana Marie Prikler
  • Maxim Cournoyer
  • Simon Tournier
Owner
unassigned
Submitted by
Liliana Marie Prikler
Severity
normal
L
L
Liliana Marie Prikler wrote on 6 May 2023 18:04
(address . guix-patches@gnu.org)
cover.1683389080.git.liliana.prikler@gmail.com
Hi Guix,

the following series adds a couple of packages that implement immutable
data structures, functional composition and all that good stuff.

Cheers

Liliana Marie Prikler (4):
gnu: Add c-rrb.
gnu: Add immer.
gnu: Add zug.
gnu: Add lager.

gnu/packages/c.scm | 25 ++++++++++++
gnu/packages/cpp.scm | 90 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 115 insertions(+)


base-commit: 7368020bef3bf5a44100c59a973412f9e254e7c6
--
2.39.2
L
L
Liliana Marie Prikler wrote on 6 May 2023 15:51
[PATCH 1/4] gnu: Add c-rrb.
(address . 63330@debbugs.gnu.org)
55db45c07b0cef946d7d6ec9379a6ecaae5d6028.1683389080.git.liliana.prikler@gmail.com
* gnu/packages/c.scm (c-rrb): New variable.
---
gnu/packages/c.scm | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)

Toggle diff (45 lines)
diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm
index b12aaf184a..b3d1b9a0d3 100644
--- a/gnu/packages/c.scm
+++ b/gnu/packages/c.scm
@@ -47,6 +47,7 @@ (define-module (gnu packages c)
#:use-module (guix store)
#:use-module (gnu packages)
#:use-module (gnu packages bash)
+ #:use-module (gnu packages bdw-gc)
#:use-module (gnu packages bootstrap)
#:use-module (gnu packages bison)
#:use-module (gnu packages check)
@@ -107,6 +108,30 @@ (define-public c-intro-and-ref
reference manual.")
(license license:fdl1.3+))))
+(define-public c-rrb
+ (let ((commit "d908617ff84515af90c454ff4d0f98675ae6b456")
+ (revision "0"))
+ (package
+ (name "c-rrb")
+ (version (git-version "0.1.0" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/hypirion/c-rrb")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0zmha3xi80vgdcwzb4vwdllf97dvggjpjfgahrpsb5f5qi3yshxa"))))
+ (build-system gnu-build-system)
+ (inputs (list libgc))
+ (native-inputs (list autoconf automake libtool))
+ (home-page "https://github.com/hypirion/c-rrb")
+ (synopsis "Relaxed Radix Balanced Trees")
+ (description "Relaxed Radix Balanced Trees are an immutable vector-like
+data structure with good performance characteristics for concatenation and
+slicing.")
+ (license license:boost1.0))))
+
(define-public cproc
(let ((commit "70fe9ef1810cc6c05bde9eb0970363c35fa7e802")
(revision "1"))
--
2.39.2
L
L
Liliana Marie Prikler wrote on 6 May 2023 15:41
[PATCH 2/4] gnu: Add immer.
(address . 63330@debbugs.gnu.org)
cfba62fdba849025d3b81b2186626a097b9a8fdc.1683389080.git.liliana.prikler@gmail.com
* gnu/packages/cpp.scm (immer): New variable.
---
gnu/packages/cpp.scm | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)

Toggle diff (53 lines)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 023d1c0337..da3567b5ef 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -67,6 +67,7 @@ (define-module (gnu packages cpp)
#:use-module (gnu packages)
#:use-module (gnu packages assembly)
#:use-module (gnu packages autotools)
+ #:use-module (gnu packages bdw-gc)
#:use-module (gnu packages boost)
#:use-module (gnu packages build-tools)
#:use-module (gnu packages c)
@@ -1390,6 +1391,38 @@ (define-public libexpected
(home-page "https://tl.tartanllama.xyz/")
(license license:cc0)))
+(define-public immer
+ (package
+ (name "immer")
+ (version "0.8.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/arximboldi/immer")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "11km3l5h3rgsbj8yfyzk3fnx9na55l6zs2sxpx922yvlvs2blh27"))
+ (modules '((guix build utils)))
+ (snippet #~(begin
+ (delete-file "tools/include/doctest.h")
+ (delete-file "tools/include/catch.hpp")
+ (substitute* (find-files "test" "\\.[cih]pp")
+ (("<catch.hpp>") "<catch2/catch.hpp>")
+ (("<doctest.h>") "<doctest/doctest.h>"))
+ (substitute* (find-files "test/oss-fuzz" "\\.cpp")
+ ;; someone used the wrong header :)
+ (("<fmt/printf.h>") "<fmt/ostream.h>"))))))
+ (build-system cmake-build-system)
+ (arguments (list #:test-target "check"))
+ (inputs (list boost libgc c-rrb))
+ (native-inputs (list catch2 doctest fmt pkg-config))
+ (home-page "https://sinusoid.es/immer")
+ (synopsis "Immutable data structures")
+ (description "Immer is a library of persistent and immutable data structures
+written in C++.")
+ (license license:boost1.0)))
+
(define-public atomic-queue
(package
(name "atomic-queue")
--
2.39.2
L
L
Liliana Marie Prikler wrote on 6 May 2023 15:43
[PATCH 3/4] gnu: Add zug.
(address . 63330@debbugs.gnu.org)
8850ffbf647e225a8fdc96acdf0e9a5df28e8f89.1683389080.git.liliana.prikler@gmail.com
* gnu/packages/cpp.scm (zug): New variable.
---
gnu/packages/cpp.scm | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)

Toggle diff (38 lines)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index da3567b5ef..0ab7d0785b 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -1423,6 +1423,31 @@ (define-public immer
written in C++.")
(license license:boost1.0)))
+(define-public zug
+ (let ((commit "d7e814b45fceceee3cb1442997d8b46cee4764ec")
+ (revision "0"))
+ (package
+ (name "zug")
+ (version (git-version "0.0.0" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/arximboldi/zug")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "1ww4prh763n81kzzijak8z495varlvqml4ip7i09klqnw6ya72fc"))
+ (modules '((guix build utils)))
+ (snippet #~(delete-file-recursively "tools"))))
+ (build-system cmake-build-system)
+ (arguments (list #:test-target "check"))
+ (native-inputs (list boost catch2))
+ (home-page "https://sinusoid.es/zug")
+ (synopsis "Higher-order sequence transformers")
+ (description "Zug is a C++ library providing transducers, that is composable
+sequential transformations.")
+ (license license:boost1.0))))
+
(define-public atomic-queue
(package
(name "atomic-queue")
--
2.39.2
L
L
Liliana Marie Prikler wrote on 6 May 2023 15:43
[PATCH 4/4] gnu: Add lager.
(address . 63330@debbugs.gnu.org)
848cb412c5732ef45f170dfb6838a3691ca3f71e.1683389080.git.liliana.prikler@gmail.com
* gnu/packages/cpp.scm (lager): New variable.
---
gnu/packages/cpp.scm | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)

Toggle diff (52 lines)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 0ab7d0785b..fe6a0edd31 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -101,6 +101,7 @@ (define-module (gnu packages cpp)
#:use-module (gnu packages web)
#:use-module (gnu packages xml)
#:use-module (gnu packages xorg)
+ #:autoload (gnu packages serialization) (cereal)
#:use-module (ice-9 match))
(define-public argagg
@@ -1448,6 +1449,37 @@ (define-public zug
sequential transformations.")
(license license:boost1.0))))
+(define-public lager
+ (let ((commit "2016df38be90ee176bcb73ea414be2318bc1ef31")
+ (revision "0"))
+ (package
+ (name "lager")
+ (version (git-version "0.0.0" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/arximboldi/lager")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "1b7zxwqrbm7db7wxqbsrk7jjd3znvvi1cwj7jg6zkmf0199071a5"))))
+ (build-system cmake-build-system)
+ (arguments (list #:test-target "check"
+ #:configure-flags #~(list "-Dlager_BUILD_EXAMPLES=no")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'delete-failing-tests
+ (lambda _
+ (delete-file-recursively "test/event_loop"))))))
+ (inputs (list boost immer zug))
+ (native-inputs (list cereal))
+ (home-page "https://sinusoid.es/lager")
+ (synopsis "Library for value-oriented design")
+ (description "Lager is a library for value-oriented design implementing
+the unidirectional data-flow architecture. Apart from a store and various
+event loops it also provides lenses and cursors.")
+ (license license:expat))))
+
(define-public atomic-queue
(package
(name "atomic-queue")
--
2.39.2
M
M
Maxim Cournoyer wrote on 7 May 2023 17:25
Re: bug#63330: [PATCH 0/4] Functional programming? In my C++?! It's more likely than you think!
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)(address . 63330@debbugs.gnu.org)
87zg6gyxh7.fsf_-_@gmail.com
Hello,

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

Toggle quote (36 lines)
> * gnu/packages/cpp.scm (zug): New variable.
> ---
> gnu/packages/cpp.scm | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
> index da3567b5ef..0ab7d0785b 100644
> --- a/gnu/packages/cpp.scm
> +++ b/gnu/packages/cpp.scm
> @@ -1423,6 +1423,31 @@ (define-public immer
> written in C++.")
> (license license:boost1.0)))
>
> +(define-public zug
> + (let ((commit "d7e814b45fceceee3cb1442997d8b46cee4764ec")
> + (revision "0"))
> + (package
> + (name "zug")
> + (version (git-version "0.0.0" revision commit))
> + (source (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://github.com/arximboldi/zug")
> + (commit commit)))
> + (file-name (git-file-name name version))
> + (sha256
> + (base32 "1ww4prh763n81kzzijak8z495varlvqml4ip7i09klqnw6ya72fc"))
> + (modules '((guix build utils)))
> + (snippet #~(delete-file-recursively "tools"))))
> + (build-system cmake-build-system)
> + (arguments (list #:test-target "check"))
> + (native-inputs (list boost catch2))
> + (home-page "https://sinusoid.es/zug")
> + (synopsis "Higher-order sequence transformers")
> + (description "Zug is a C++ library providing transducers, that is composable

^,
I'd add a coma after "that is".

Otherwise LGTM.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 7 May 2023 17:30
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)(address . 63330@debbugs.gnu.org)
87v8h4yx9u.fsf_-_@gmail.com
Hi,

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

Toggle quote (44 lines)
> * gnu/packages/cpp.scm (immer): New variable.
> ---
> gnu/packages/cpp.scm | 33 +++++++++++++++++++++++++++++++++
> 1 file changed, 33 insertions(+)
>
> diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
> index 023d1c0337..da3567b5ef 100644
> --- a/gnu/packages/cpp.scm
> +++ b/gnu/packages/cpp.scm
> @@ -67,6 +67,7 @@ (define-module (gnu packages cpp)
> #:use-module (gnu packages)
> #:use-module (gnu packages assembly)
> #:use-module (gnu packages autotools)
> + #:use-module (gnu packages bdw-gc)
> #:use-module (gnu packages boost)
> #:use-module (gnu packages build-tools)
> #:use-module (gnu packages c)
> @@ -1390,6 +1391,38 @@ (define-public libexpected
> (home-page "https://tl.tartanllama.xyz/")
> (license license:cc0)))
>
> +(define-public immer
> + (package
> + (name "immer")
> + (version "0.8.0")
> + (source (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://github.com/arximboldi/immer")
> + (commit (string-append "v" version))))
> + (file-name (git-file-name name version))
> + (sha256
> + (base32 "11km3l5h3rgsbj8yfyzk3fnx9na55l6zs2sxpx922yvlvs2blh27"))
> + (modules '((guix build utils)))
> + (snippet #~(begin
> + (delete-file "tools/include/doctest.h")
> + (delete-file "tools/include/catch.hpp")
> + (substitute* (find-files "test" "\\.[cih]pp")
> + (("<catch.hpp>") "<catch2/catch.hpp>")
> + (("<doctest.h>") "<doctest/doctest.h>"))
> + (substitute* (find-files "test/oss-fuzz" "\\.cpp")
> + ;; someone used the wrong header :)
> + (("<fmt/printf.h>") "<fmt/ostream.h>"))))))

Did you report the wrong header usage upstream? A less intrusive fix
for the catch/doctest include problem could be to add their include
subdirectories as -I directives to the CXXFLAGS environment variable, or
since that's CMake, via its CMAKE_CXX_FLAGS make options. See 'clara'
for an actual example.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 7 May 2023 17:34
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)(address . 63330@debbugs.gnu.org)
87o7mwyx3h.fsf_-_@gmail.com
Hi Liliana,

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

Toggle quote (16 lines)
> * gnu/packages/cpp.scm (lager): New variable.
> ---
> gnu/packages/cpp.scm | 32 ++++++++++++++++++++++++++++++++
> 1 file changed, 32 insertions(+)
>
> diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
> index 0ab7d0785b..fe6a0edd31 100644
> --- a/gnu/packages/cpp.scm
> +++ b/gnu/packages/cpp.scm
> @@ -101,6 +101,7 @@ (define-module (gnu packages cpp)
> #:use-module (gnu packages web)
> #:use-module (gnu packages xml)
> #:use-module (gnu packages xorg)
> + #:autoload (gnu packages serialization) (cereal)
> #:use-module (ice-9 match))

Does autoload buys us something here? Otherwise I'd stick with the
conventional use-module, to avoid future instances of cargo-culting :-).

In my opinion, that's a direction that should be pursued in Guile
(autoloading modules by default when declarative modules (no side
effects allowed) are used) rather than in every Guile applications out
there.

Otherwise this series LGTM, with the minor comments I left earlier taken
into account.

--
Thanks,
Maxim
L
L
Liliana Marie Prikler wrote on 7 May 2023 17:51
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(address . 63330@debbugs.gnu.org)
1db1242ff474042bb007ace4ab4421f9061db2a6.camel@gmail.com
Am Sonntag, dem 07.05.2023 um 11:30 -0400 schrieb Maxim Cournoyer:
Toggle quote (54 lines)
> Hi,
>
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
>
> > * gnu/packages/cpp.scm (immer): New variable.
> > ---
> >  gnu/packages/cpp.scm | 33 +++++++++++++++++++++++++++++++++
> >  1 file changed, 33 insertions(+)
> >
> > diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
> > index 023d1c0337..da3567b5ef 100644
> > --- a/gnu/packages/cpp.scm
> > +++ b/gnu/packages/cpp.scm
> > @@ -67,6 +67,7 @@ (define-module (gnu packages cpp)
> >    #:use-module (gnu packages)
> >    #:use-module (gnu packages assembly)
> >    #:use-module (gnu packages autotools)
> > +  #:use-module (gnu packages bdw-gc)
> >    #:use-module (gnu packages boost)
> >    #:use-module (gnu packages build-tools)
> >    #:use-module (gnu packages c)
> > @@ -1390,6 +1391,38 @@ (define-public libexpected
> >      (home-page "https://tl.tartanllama.xyz/")
> >      (license license:cc0)))
> >  
> > +(define-public immer
> > +  (package
> > +   (name "immer")
> > +   (version "0.8.0")
> > +   (source (origin
> > +            (method git-fetch)
> > +            (uri (git-reference
> > +                  (url "https://github.com/arximboldi/immer")
> > +                  (commit (string-append "v" version))))
> > +            (file-name (git-file-name name version))
> > +            (sha256
> > +             (base32
> > "11km3l5h3rgsbj8yfyzk3fnx9na55l6zs2sxpx922yvlvs2blh27"))
> > +            (modules '((guix build utils)))
> > +            (snippet #~(begin
> > +                         (delete-file "tools/include/doctest.h")
> > +                         (delete-file "tools/include/catch.hpp")
> > +                         (substitute* (find-files "test"
> > "\\.[cih]pp")
> > +                           (("<catch.hpp>") "<catch2/catch.hpp>")
> > +                           (("<doctest.h>")
> > "<doctest/doctest.h>"))
> > +                         (substitute* (find-files "test/oss-fuzz"
> > "\\.cpp")
> > +                           ;; someone used the wrong header :)
> > +                           (("<fmt/printf.h>")
> > "<fmt/ostream.h>"))))))
>
> Did you report the wrong header usage upstream?  
I must admit, I did not.

Toggle quote (4 lines)
> A less intrusive fix for the catch/doctest include problem could be
> to add their include subdirectories as -I directives to the CXXFLAGS
> environment variable, or since that's CMake, via its CMAKE_CXX_FLAGS
> make options.  See 'clara' for an actual example.
There are other packages that take the approach I used here. I do
think this is a CMakeFiles bug, but not one I want to fix.

Cheers
L
L
Liliana Marie Prikler wrote on 7 May 2023 17:57
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(address . 63330@debbugs.gnu.org)
5b96284b29db54d4b15028adf7b4b82613987051.camel@gmail.com
Am Sonntag, dem 07.05.2023 um 11:34 -0400 schrieb Maxim Cournoyer:
Toggle quote (23 lines)
> Hi Liliana,
>
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
>
> > * gnu/packages/cpp.scm (lager): New variable.
> > ---
> >  gnu/packages/cpp.scm | 32 ++++++++++++++++++++++++++++++++
> >  1 file changed, 32 insertions(+)
> >
> > diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
> > index 0ab7d0785b..fe6a0edd31 100644
> > --- a/gnu/packages/cpp.scm
> > +++ b/gnu/packages/cpp.scm
> > @@ -101,6 +101,7 @@ (define-module (gnu packages cpp)
> >    #:use-module (gnu packages web)
> >    #:use-module (gnu packages xml)
> >    #:use-module (gnu packages xorg)
> > +  #:autoload   (gnu packages serialization) (cereal)
> >    #:use-module (ice-9 match))
>
> Does autoload buys us something here?  Otherwise I'd stick with the
> conventional use-module, to avoid future instances of cargo-culting
> :-).
It only frees us from the import cycle that would exist otherwise.

Toggle quote (4 lines)
> In my opinion, that's a direction that should be pursued in Guile
> (autoloading modules by default when declarative modules (no side
> effects allowed) are used) rather than in every Guile applications
> out there.
Not sure I understand what you're saying, nor the impact of it.

Cheers
M
M
Maxim Cournoyer wrote on 7 May 2023 19:10
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)(address . 63330@debbugs.gnu.org)
877ctkysm7.fsf@gmail.com
Hi,

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

Toggle quote (26 lines)
> Am Sonntag, dem 07.05.2023 um 11:34 -0400 schrieb Maxim Cournoyer:
>> Hi Liliana,
>>
>> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
>>
>> > * gnu/packages/cpp.scm (lager): New variable.
>> > ---
>> >  gnu/packages/cpp.scm | 32 ++++++++++++++++++++++++++++++++
>> >  1 file changed, 32 insertions(+)
>> >
>> > diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
>> > index 0ab7d0785b..fe6a0edd31 100644
>> > --- a/gnu/packages/cpp.scm
>> > +++ b/gnu/packages/cpp.scm
>> > @@ -101,6 +101,7 @@ (define-module (gnu packages cpp)
>> >    #:use-module (gnu packages web)
>> >    #:use-module (gnu packages xml)
>> >    #:use-module (gnu packages xorg)
>> > +  #:autoload   (gnu packages serialization) (cereal)
>> >    #:use-module (ice-9 match))
>>
>> Does autoload buys us something here?  Otherwise I'd stick with the
>> conventional use-module, to avoid future instances of cargo-culting
>> :-).
> It only frees us from the import cycle that would exist otherwise.

OK, that's a good reason to have it.

Toggle quote (6 lines)
>> In my opinion, that's a direction that should be pursued in Guile
>> (autoloading modules by default when declarative modules (no side
>> effects allowed) are used) rather than in every Guile applications
>> out there.
> Not sure I understand what you're saying, nor the impact of it.

I meant that it'd be nice if Guile gave us lazy loading by default
instead of relying on humans to use #:autoload where it makes sense.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 7 May 2023 19:12
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)(address . 63330@debbugs.gnu.org)
873548ysj8.fsf@gmail.com
Hi,
Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
Toggle quote (56 lines)
> Am Sonntag, dem 07.05.2023 um 11:30 -0400 schrieb Maxim Cournoyer:
>> Hi,
>>
>> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
>>
>> > * gnu/packages/cpp.scm (immer): New variable.
>> > ---
>> >  gnu/packages/cpp.scm | 33 +++++++++++++++++++++++++++++++++
>> >  1 file changed, 33 insertions(+)
>> >
>> > diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
>> > index 023d1c0337..da3567b5ef 100644
>> > --- a/gnu/packages/cpp.scm
>> > +++ b/gnu/packages/cpp.scm
>> > @@ -67,6 +67,7 @@ (define-module (gnu packages cpp)
>> >    #:use-module (gnu packages)
>> >    #:use-module (gnu packages assembly)
>> >    #:use-module (gnu packages autotools)
>> > +  #:use-module (gnu packages bdw-gc)
>> >    #:use-module (gnu packages boost)
>> >    #:use-module (gnu packages build-tools)
>> >    #:use-module (gnu packages c)
>> > @@ -1390,6 +1391,38 @@ (define-public libexpected
>> >      (home-page "https://tl.tartanllama.xyz/")
>> >      (license license:cc0)))
>> >  
>> > +(define-public immer
>> > +  (package
>> > +   (name "immer")
>> > +   (version "0.8.0")
>> > +   (source (origin
>> > +            (method git-fetch)
>> > +            (uri (git-reference
>> > +                  (url "https://github.com/arximboldi/immer")
>> > +                  (commit (string-append "v" version))))
>> > +            (file-name (git-file-name name version))
>> > +            (sha256
>> > +             (base32
>> > "11km3l5h3rgsbj8yfyzk3fnx9na55l6zs2sxpx922yvlvs2blh27"))
>> > +            (modules '((guix build utils)))
>> > +            (snippet #~(begin
>> > +                         (delete-file "tools/include/doctest.h")
>> > +                         (delete-file "tools/include/catch.hpp")
>> > +                         (substitute* (find-files "test"
>> > "\\.[cih]pp")
>> > +                           (("<catch.hpp>") "<catch2/catch.hpp>")
>> > +                           (("<doctest.h>")
>> > "<doctest/doctest.h>"))
>> > +                         (substitute* (find-files "test/oss-fuzz"
>> > "\\.cpp")
>> > +                           ;; someone used the wrong header :)
>> > +                           (("<fmt/printf.h>")
>> > "<fmt/ostream.h>"))))))
>>
>> Did you report the wrong header usage upstream?  
> I must admit, I did not.
Could you please do so, if that's not too much to ask? Then include a
(see: URL) next to the substitution comment.
Toggle quote (6 lines)
>> A less intrusive fix for the catch/doctest include problem could be
>> to add their include subdirectories as -I directives to the CXXFLAGS
>> environment variable, or since that's CMake, via its CMAKE_CXX_FLAGS
>> make options.  See 'clara' for an actual example.
> There are other packages that take the approach I used here. I do
> think this is a CMakeFiles bug, but not one I want to fix.
I think catch2 is selfom used from the system (typically bundled), must
not ship with any pkg-config or proper support to be auto-detected at
configure time, which gives us the situation we're in.
--
Thanks,
Maxim
L
L
Liliana Marie Prikler wrote on 7 May 2023 21:40
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(address . 63330@debbugs.gnu.org)
750a060f3435255a7765a0ee6df1ef60de46f483.camel@gmail.com
Hi,

Am Sonntag, dem 07.05.2023 um 13:12 -0400 schrieb Maxim Cournoyer:
Toggle quote (8 lines)
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
>
> > Am Sonntag, dem 07.05.2023 um 11:30 -0400 schrieb Maxim Cournoyer:
> > > Did you report the wrong header usage upstream?  
> > I must admit, I did not.
>
> Could you please do so, if that's not too much to ask?  Then include
> a (see: URL) next to the substitution comment.
I sent a mail to the address in the README; let's wait for a reply.

Toggle quote (6 lines)
> > > A less intrusive fix for the catch/doctest include problem could
> > > be to add their include subdirectories as -I directives to the
> > > CXXFLAGS environment variable, or since that's CMake, via its
> > > CMAKE_CXX_FLAGS make options.  See 'clara' for an actual example.
> > There are other packages that take the approach I used here.  I do
> > think this is a CMakeFiles bug, but not one I want to fix.
Correction to myself: I now see that we only need to edit those source
files because we remove the bundled ones, but that's an argument
towards keeping that within the snippet imho.

Toggle quote (3 lines)
> I think catch2 is selfom used from the system (typically bundled),
> must not ship with any pkg-config or proper support to be auto-
> detected at configure time, which gives us the situation we're in.
Joke's on you, catch2 ships with both CMake's config stuff *and* pkg-
config. Vendoring it is next to pointless (that is, unless you regard
sneaking it onto ancient Debian as the point). Doctest also comes with
the usual CMake blurb.

Cheers
S
S
Simon Tournier wrote on 11 May 2023 15:23
Re: [bug#63330] [PATCH 0/4] Functional programming? In my C++?! It's more likely than you think!
(address . 63330@debbugs.gnu.org)
87cz373st6.fsf@gmail.com
Hi,

On dim., 07 mai 2023 at 13:10, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:

Toggle quote (10 lines)
>>> > +  #:autoload   (gnu packages serialization) (cereal)
>>> >    #:use-module (ice-9 match))
>>>
>>> Does autoload buys us something here?  Otherwise I'd stick with the
>>> conventional use-module, to avoid future instances of cargo-culting
>>> :-).
>> It only frees us from the import cycle that would exist otherwise.
>
> OK, that's a good reason to have it.

Maybe a comment would be helpful to remember that answer. :-)

Elsewhere, we use:

Toggle snippet (9 lines)
(inputs
(list ;; XXX: We can't simply #:use-module due to a cycle somewhere.
(module-ref
(resolve-interface '(gnu packages engineering))
'cgns)
cli11
[...]

see paraview-5.9, d-tools, make-autoconf-wrapper, etc.


Cheers,
simon
L
L
Liliana Marie Prikler wrote on 14 May 2023 12:31
(address . 63330-done@debbugs.gnu.org)
15c6ca037bd90c11e0267dbd02935dff5b1aef9d.camel@gmail.com
Am Donnerstag, dem 11.05.2023 um 15:23 +0200 schrieb Simon Tournier:
Toggle quote (1 lines)
> Maybe a comment would be helpful to remember that answer. :-)
Point taken.

Pushed the series with a follow-up commit to add said comment.

Cheers
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 63330@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 63330
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch