GNU bug report logs - #46124
[PATCH] Idris 2

Previous Next

Package: guix-patches;

Reported by: raingloom <raingloom <at> riseup.net>

Date: Wed, 27 Jan 2021 06:32:02 UTC

Severity: normal

Tags: patch

Merged with 49607

To reply to this bug, email your comments to 46124 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#46124; Package guix-patches. (Wed, 27 Jan 2021 06:32:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to raingloom <raingloom <at> riseup.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 27 Jan 2021 06:32:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: raingloom <raingloom <at> riseup.net>
To: Guix Patches <guix-patches <at> gnu.org>
Subject: [PATCH] Idris 2
Date: Wed, 27 Jan 2021 06:43:37 +0100
Now that Idris 2 has had some proper tagged releases, I thought I'd
move it from my channel to Guix proper.
I've been using this package for quite a few months now and it pretty
much works. REPL works, building things works. Couldn't try IDE
functionality but I suppose it probably works if you can set it up in
Vim. That reminds me, I still haven't packaged the Vim mode, but I
don't use Vim so I don't really know its module system.

## Still TODO for the package:

search paths: There are no 3rd party Idris 2 modules yet, but it should
be done soon.

output prefix weirdness: Output is a bit odd, having an idris2-0.3.0
directory in its root, but since this is Guix, I suppose that's not
really a problem. Everything else is in its proper place, in bin, lib,
and share.

clang-toolchain support: Right now CC=gcc is hardcoded. Auto detection
would be preferable.

bootstrap: Right now it's bootstrapped from auto-generated Chez or
Racket. It **can** be built with Idris 1, but it uses such on obscene
amount of RAM that I refuse to consider building it that way ever
again. If someone wants to incorporate that step into Guix, they are
free to do so. Or we could generate it once and then freeze it and use
it as an input. Just leave my poor laptop out of it, it already
suffered enough. And probably leave the CI infrastructure out of it too.


## Bigger TODO:
Build system. Eventually it will need one.
Considering that it has multiple code generation backends, this is not
trivial, as each backend uses a different existing language, the
official ones (that I can remember right now) being:
* Chez
* Racket
* Gambit
* Chicken
* JavaScript/Node
* C

It might also make sense to compile Idris 2 itself with different
backends. It "officially" supports bootstrapping with Chez and Racket,
but others might be possible too.


Anyways, here's the patch, have fun with it, and/or suggest changes,
etc!




Information forwarded to guix-patches <at> gnu.org:
bug#46124; Package guix-patches. (Mon, 26 Apr 2021 20:47:03 GMT) Full text and rfc822 format available.

Message #8 received at 46124 <at> debbugs.gnu.org (full text, mbox):

From: raingloom <raingloom <at> riseup.net>
To: Xinglu Chen <public <at> yoctocell.xyz>
Cc: 46124 <at> debbugs.gnu.org
Subject: Re: [bug#46124] [PATCH] Idris 2
Date: Mon, 26 Apr 2021 17:22:40 +0200
[Message part 1 (text/plain, inline)]
On Thu, 22 Apr 2021 10:39:53 +0200
Xinglu Chen <public <at> yoctocell.xyz> wrote:

> I think you forgot the attach the patch. ;)
> 

Ah heck. That might have been the case.
Here it is.

There hasn't been a tagged release since then, so I'm sending my
original patch, but I should note that in my channel I've been tracking
the latest commit, which does seem to work, although it's been a while
since I used Idris for anything complicated.
[0001-gnu-Added-Idris-2.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#46124; Package guix-patches. (Mon, 26 Apr 2021 21:28:02 GMT) Full text and rfc822 format available.

Message #11 received at 46124 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: raingloom <raingloom <at> riseup.net>, Xinglu Chen <public <at> yoctocell.xyz>
Cc: 46124 <at> debbugs.gnu.org
Subject: Re: [bug#46124] [PATCH] Idris 2
Date: Mon, 26 Apr 2021 23:27:39 +0200
[Message part 1 (text/plain, inline)]
raingloom schreef op ma 26-04-2021 om 17:22 [+0200]:
> There hasn't been a tagged release since then, so I'm sending my
> original patch, but I should note that in my channel I've been tracking
> the latest commit, which does seem to work, although it's been a while
> since I used Idris for anything complicated.
> 
> +                     ;; TODO detect toolchain
> +                     "CC=gcc")))

Unless idris has a compiler built in that uses gcc for compiling
idris to machine code, this should likely be
,(string-append "CC=" (cc-for-target)) instead, such that the
cross-compiler is used when cross-compiling.

Teaching (cc-for-target) to detect which toolchain should be used
is a separate matter.  Maybe it could be a macro that looks at
(package-native-inputs this-package) or something.

Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#46124; Package guix-patches. (Thu, 29 Apr 2021 23:21:02 GMT) Full text and rfc822 format available.

Message #14 received at 46124 <at> debbugs.gnu.org (full text, mbox):

From: raingloom <raingloom <at> riseup.net>
To: Maxime Devos <maximedevos <at> telenet.be>
Cc: Xinglu Chen <public <at> yoctocell.xyz>, 46124 <at> debbugs.gnu.org
Subject: Re: [bug#46124] [PATCH] Idris 2
Date: Thu, 29 Apr 2021 20:43:17 +0200
[Message part 1 (text/plain, inline)]
On Mon, 26 Apr 2021 23:27:39 +0200
Maxime Devos <maximedevos <at> telenet.be> wrote:

> raingloom schreef op ma 26-04-2021 om 17:22 [+0200]:
> > There hasn't been a tagged release since then, so I'm sending my
> > original patch, but I should note that in my channel I've been
> > tracking the latest commit, which does seem to work, although it's
> > been a while since I used Idris for anything complicated.
> > 
> > +                     ;; TODO detect toolchain
> > +                     "CC=gcc")))  
> 
> Unless idris has a compiler built in that uses gcc for compiling
> idris to machine code, this should likely be
> ,(string-append "CC=" (cc-for-target)) instead, such that the
> cross-compiler is used when cross-compiling.
> 
> Teaching (cc-for-target) to detect which toolchain should be used
> is a separate matter.  Maybe it could be a macro that looks at
> (package-native-inputs this-package) or something.
> 
> Greetings,
> Maxime.

Oh, that's a leftover, I was using clang for a while, since it's
said to use less RAM. I switched back to gcc and left that in.

Here is the updated patch. No idea if this actually works cross
compiled, but I don't have much time to test it. My suspicion is that
it's likely broken and requires changes to Idris 2's code generators,
because they almost definitely call Chez, GCC, etc, with the wrong
arguments.
[0001-gnu-Added-Idris-2.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#46124; Package guix-patches. (Fri, 30 Apr 2021 08:25:01 GMT) Full text and rfc822 format available.

Message #17 received at 46124 <at> debbugs.gnu.org (full text, mbox):

From: Xinglu Chen <public <at> yoctocell.xyz>
To: raingloom <raingloom <at> riseup.net>, Maxime Devos <maximedevos <at> telenet.be>
Cc: 46124 <at> debbugs.gnu.org
Subject: Re: [bug#46124] [PATCH] Idris 2
Date: Fri, 30 Apr 2021 10:24:42 +0200
On Thu, Apr 29 2021, raingloom wrote:

> Here is the updated patch. No idea if this actually works cross
> compiled, but I don't have much time to test it. My suspicion is that
> it's likely broken and requires changes to Idris 2's code generators,
> because they almost definitely call Chez, GCC, etc, with the wrong
> arguments.

I noticed that there is an ‘idris2_app’ directory in the ‘bin’ directory

  $ ls /gnu/store/va62hzp46c3dp2vlcnqc7fg109axj8rq-idris2-0.3.0/bin
  idris2*  idris2_app/

What is this used for?





Information forwarded to guix-patches <at> gnu.org:
bug#46124; Package guix-patches. (Fri, 30 Apr 2021 08:52:01 GMT) Full text and rfc822 format available.

Message #20 received at 46124 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: raingloom <raingloom <at> riseup.net>
Cc: Xinglu Chen <public <at> yoctocell.xyz>, 46124 <at> debbugs.gnu.org
Subject: Re: [bug#46124] [PATCH] Idris 2
Date: Fri, 30 Apr 2021 10:50:51 +0200
[Message part 1 (text/plain, inline)]
raingloom schreef op do 29-04-2021 om 20:43 [+0200]:
> On Mon, 26 Apr 2021 23:27:39 +0200
> Maxime Devos <maximedevos <at> telenet.be> wrote:
> 
> > raingloom schreef op ma 26-04-2021 om 17:22 [+0200]:
> > > [...]
> > > 
> > > +                     ;; TODO detect toolchain
> > > +                     "CC=gcc")))  
> > 
> > Unless idris has a compiler built in that uses gcc for compiling
> > idris to machine code, this should likely be
> > ,(string-append "CC=" (cc-for-target)) instead, such that the
> > cross-compiler is used when cross-compiling.
> > 
> > [...]
> Oh, that's a leftover, I was using clang for a while, since it's
> said to use less RAM. I switched back to gcc and left that in.
> 
> Here is the updated patch. No idea if this actually works cross
> compiled, but I don't have much time to test it.

IIUC, cross-compilation is not required to be supported by each
package in guix. It is something nice-to-have, but not strictly
required.

Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#46124; Package guix-patches. (Mon, 03 May 2021 09:08:01 GMT) Full text and rfc822 format available.

Message #23 received at 46124 <at> debbugs.gnu.org (full text, mbox):

From: raingloom <raingloom <at> riseup.net>
To: Xinglu Chen <public <at> yoctocell.xyz>
Cc: Maxime Devos <maximedevos <at> telenet.be>, 46124 <at> debbugs.gnu.org
Subject: Re: [bug#46124] [PATCH] Idris 2
Date: Mon, 3 May 2021 04:10:44 +0200
On Fri, 30 Apr 2021 10:24:42 +0200
Xinglu Chen <public <at> yoctocell.xyz> wrote:

> On Thu, Apr 29 2021, raingloom wrote:
> 
> > Here is the updated patch. No idea if this actually works cross
> > compiled, but I don't have much time to test it. My suspicion is
> > that it's likely broken and requires changes to Idris 2's code
> > generators, because they almost definitely call Chez, GCC, etc,
> > with the wrong arguments.  
> 
> I noticed that there is an ‘idris2_app’ directory in the ‘bin’
> directory
> 
>   $ ls /gnu/store/va62hzp46c3dp2vlcnqc7fg109axj8rq-idris2-0.3.0/bin
>   idris2*  idris2_app/
> 
> What is this used for?
> 

If you take a look at $(guix build idris2)/bin/idris2, it's actually
just a wrapper. It contains the supporting dynamically linked shared
objects and the executable itself.

I don't know the details of what each file does or why it's like this,
the codegen seems to use a similar structure for all backends. The
scheme files are probably all for the Chez backend, the shared objects
are either C libraries (for socket support and stuff), or compiled Chez
code. I just noticed the Racket script, that I have no idea about.

Idris 2's build system makes some... uhm... interesting choices, so
it's entirely possible that not all of those are necessary, or could be
moved somewhere more sensible.




Information forwarded to guix-patches <at> gnu.org:
bug#46124; Package guix-patches. (Tue, 04 May 2021 17:13:02 GMT) Full text and rfc822 format available.

Message #26 received at 46124 <at> debbugs.gnu.org (full text, mbox):

From: Xinglu Chen <public <at> yoctocell.xyz>
To: raingloom <raingloom <at> riseup.net>
Cc: Maxime Devos <maximedevos <at> telenet.be>, 46124 <at> debbugs.gnu.org
Subject: Re: [bug#46124] [PATCH] Idris 2
Date: Tue, 04 May 2021 19:12:18 +0200
On Mon, May 03 2021, raingloom wrote:

> On Fri, 30 Apr 2021 10:24:42 +0200
> Xinglu Chen <public <at> yoctocell.xyz> wrote:
>
>> On Thu, Apr 29 2021, raingloom wrote:
>> 
>> > Here is the updated patch. No idea if this actually works cross
>> > compiled, but I don't have much time to test it. My suspicion is
>> > that it's likely broken and requires changes to Idris 2's code
>> > generators, because they almost definitely call Chez, GCC, etc,
>> > with the wrong arguments.  
>> 
>> I noticed that there is an ‘idris2_app’ directory in the ‘bin’
>> directory
>> 
>>   $ ls /gnu/store/va62hzp46c3dp2vlcnqc7fg109axj8rq-idris2-0.3.0/bin
>>   idris2*  idris2_app/
>> 
>> What is this used for?
>
> If you take a look at $(guix build idris2)/bin/idris2, it's actually
> just a wrapper. It contains the supporting dynamically linked shared
> objects and the executable itself.
>
> I don't know the details of what each file does or why it's like this,
> the codegen seems to use a similar structure for all backends. The
> scheme files are probably all for the Chez backend, the shared objects
> are either C libraries (for socket support and stuff), or compiled Chez
> code. I just noticed the Racket script, that I have no idea about.
>
> Idris 2's build system makes some... uhm... interesting choices, so
> it's entirely possible that not all of those are necessary, or could be
> moved somewhere more sensible.

Looking at the Nix package, they remove the wrapper and instead move
bin/idris2_app/idris2.so to bin/idris2 and wraps that executable[1].
Perhaps we could do the same thing?  I am not familiar with Idris,
though.

[1]: https://github.com/nixos/nixpkgs/blob//pkgs/development/compilers/idris2/default.nix#L41




Information forwarded to guix-patches <at> gnu.org:
bug#46124; Package guix-patches. (Wed, 12 May 2021 14:54:01 GMT) Full text and rfc822 format available.

Message #29 received at 46124 <at> debbugs.gnu.org (full text, mbox):

From: raingloom <raingloom <at> riseup.net>
To: Xinglu Chen <public <at> yoctocell.xyz>
Cc: Maxime Devos <maximedevos <at> telenet.be>, 46124 <at> debbugs.gnu.org
Subject: Re: [bug#46124] [PATCH] Idris 2
Date: Tue, 11 May 2021 23:47:34 +0200
On Tue, 04 May 2021 19:12:18 +0200
Xinglu Chen <public <at> yoctocell.xyz> wrote:

> On Mon, May 03 2021, raingloom wrote:
> 
> > On Fri, 30 Apr 2021 10:24:42 +0200
> > Xinglu Chen <public <at> yoctocell.xyz> wrote:
> >  
> >> On Thu, Apr 29 2021, raingloom wrote:
> >>   
> >> > Here is the updated patch. No idea if this actually works cross
> >> > compiled, but I don't have much time to test it. My suspicion is
> >> > that it's likely broken and requires changes to Idris 2's code
> >> > generators, because they almost definitely call Chez, GCC, etc,
> >> > with the wrong arguments.    
> >> 
> >> I noticed that there is an ‘idris2_app’ directory in the ‘bin’
> >> directory
> >> 
> >>   $ ls /gnu/store/va62hzp46c3dp2vlcnqc7fg109axj8rq-idris2-0.3.0/bin
> >>   idris2*  idris2_app/
> >> 
> >> What is this used for?  
> >
> > If you take a look at $(guix build idris2)/bin/idris2, it's actually
> > just a wrapper. It contains the supporting dynamically linked shared
> > objects and the executable itself.
> >
> > I don't know the details of what each file does or why it's like
> > this, the codegen seems to use a similar structure for all
> > backends. The scheme files are probably all for the Chez backend,
> > the shared objects are either C libraries (for socket support and
> > stuff), or compiled Chez code. I just noticed the Racket script,
> > that I have no idea about.
> >
> > Idris 2's build system makes some... uhm... interesting choices, so
> > it's entirely possible that not all of those are necessary, or
> > could be moved somewhere more sensible.  
> 
> Looking at the Nix package, they remove the wrapper and instead move
> bin/idris2_app/idris2.so to bin/idris2 and wraps that executable[1].
> Perhaps we could do the same thing?  I am not familiar with Idris,
> though.
> 
> [1]:
> https://github.com/nixos/nixpkgs/blob//pkgs/development/compilers/idris2/default.nix#L41

That link doesn't work.

I have some more pressing projects to work on, but I'll look into it.




Information forwarded to guix-patches <at> gnu.org:
bug#46124; Package guix-patches. (Fri, 14 May 2021 12:09:02 GMT) Full text and rfc822 format available.

Message #32 received at 46124 <at> debbugs.gnu.org (full text, mbox):

From: Xinglu Chen <public <at> yoctocell.xyz>
To: raingloom <raingloom <at> riseup.net>
Cc: Maxime Devos <maximedevos <at> telenet.be>, 46124 <at> debbugs.gnu.org
Subject: Re: [bug#46124] [PATCH] Idris 2
Date: Fri, 14 May 2021 14:08:33 +0200
[Message part 1 (text/plain, inline)]
On Tue, May 11 2021, raingloom wrote:

>> 
>> [1]:
>> https://github.com/nixos/nixpkgs/blob//pkgs/development/compilers/idris2/default.nix#L41
>
> That link doesn't work.

Sorry, this one should work 

  https://github.com/NixOS/nixpkgs/blob/8284fc30c84ea47e63209d1a892aca1dfcd6bdf3/pkgs/development/compilers/idris2/default.nix#L35
  
[signature.asc (application/pgp-signature, inline)]

Merged 46124 49607. Request was from Tobias Geerinckx-Rice <me <at> tobias.gr> to control <at> debbugs.gnu.org. (Wed, 11 May 2022 12:59:02 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 33 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.