Quantcast

What is a good way to test library on several ghc's?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

What is a good way to test library on several ghc's?

Anton Kholomiov
Someone asked to add support in my lib for older version of GHC.
I know that there are GHC-version specific pragmas to
activate the code on specific version.

I'm not quite sure how to setup the environment to use several GHCs.
How do you do that kind of thing?

Cheers!
Anton

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: What is a good way to test library on several ghc's?

Edward Z. Yang
If you are on Ubuntu, check out hvr's PPA:
https://launchpad.net/~hvr/+archive/ubuntu/ghc

https://github.com/hvr/multi-ghc-travis may also be of interest

Excerpts from Anton Kholomiov's message of 2017-03-13 10:27:15 +0300:
> Someone asked to add support in my lib for older version of GHC.
> I know that there are GHC-version specific pragmas to
> activate the code on specific version.
>
> I'm not quite sure how to setup the environment to use several GHCs.
> How do you do that kind of thing?
>
> Cheers!
> Anton
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: What is a good way to test library on several ghc's?

Ertugrul Söylemez-3
In reply to this post by Anton Kholomiov
> Someone asked to add support in my lib for older version of GHC.
> I know that there are GHC-version specific pragmas to activate the
> code on specific version.
>
> I'm not quite sure how to setup the environment to use several GHCs.
> How do you do that kind of thing?

You can do it quite easily with Nix (which you can use alongside your
normal package manager without interference, if you're not on NixOS).
Type in your package's root directory:

    cabal2nix --shell > shell.nix

Then you can build your package with various compiler versions:

    nix-build shell.nix --argstr compiler ghc803
    nix-build shell.nix --argstr compiler ghc7103
    nix-build shell.nix --argstr compiler ghcjs

If a build is successful, you will get a symlink called 'result', which
points to an installed version if your package including documentation.
Once you're done testing, just delete that link.

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.

signature.asc (497 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: What is a good way to test library on several ghc's?

Alan & Kim Zimmerman
Once you have installed the various GHC compilers from HVR's PPA, you can do

cabal configure --with-compiler=ghc-7.10.3

etc

Alan

On 13 March 2017 at 10:28, Ertugrul Söylemez <[hidden email]> wrote:
> Someone asked to add support in my lib for older version of GHC.
> I know that there are GHC-version specific pragmas to activate the
> code on specific version.
>
> I'm not quite sure how to setup the environment to use several GHCs.
> How do you do that kind of thing?

You can do it quite easily with Nix (which you can use alongside your
normal package manager without interference, if you're not on NixOS).
Type in your package's root directory:

    cabal2nix --shell > shell.nix

Then you can build your package with various compiler versions:

    nix-build shell.nix --argstr compiler ghc803
    nix-build shell.nix --argstr compiler ghc7103
    nix-build shell.nix --argstr compiler ghcjs

If a build is successful, you will get a symlink called 'result', which
points to an installed version if your package including documentation.
Once you're done testing, just delete that link.

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.


_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: What is a good way to test library on several ghc's?

Alan & Kim Zimmerman

On 13 March 2017 at 10:34, Alan & Kim Zimmerman <[hidden email]> wrote:
Once you have installed the various GHC compilers from HVR's PPA, you can do

cabal configure --with-compiler=ghc-7.10.3

etc

Alan

On 13 March 2017 at 10:28, Ertugrul Söylemez <[hidden email]> wrote:
> Someone asked to add support in my lib for older version of GHC.
> I know that there are GHC-version specific pragmas to activate the
> code on specific version.
>
> I'm not quite sure how to setup the environment to use several GHCs.
> How do you do that kind of thing?

You can do it quite easily with Nix (which you can use alongside your
normal package manager without interference, if you're not on NixOS).
Type in your package's root directory:

    cabal2nix --shell > shell.nix

Then you can build your package with various compiler versions:

    nix-build shell.nix --argstr compiler ghc803
    nix-build shell.nix --argstr compiler ghc7103
    nix-build shell.nix --argstr compiler ghcjs

If a build is successful, you will get a symlink called 'result', which
points to an installed version if your package including documentation.
Once you're done testing, just delete that link.

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.



_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: What is a good way to test library on several ghc's?

Adam Bergmark-2
There are a bunch of compat libraries such as base-compat and transformers-compat that will make your life a lot easier, having to maintain CPP yourself is very error prone.

HTH,
Adam


On Mon, 13 Mar 2017 at 09:41 Alan & Kim Zimmerman <[hidden email]> wrote:

On 13 March 2017 at 10:34, Alan & Kim Zimmerman <[hidden email]> wrote:
Once you have installed the various GHC compilers from HVR's PPA, you can do

cabal configure --with-compiler=ghc-7.10.3

etc

Alan

On 13 March 2017 at 10:28, Ertugrul Söylemez <[hidden email]> wrote:
> Someone asked to add support in my lib for older version of GHC.
> I know that there are GHC-version specific pragmas to activate the
> code on specific version.
>
> I'm not quite sure how to setup the environment to use several GHCs.
> How do you do that kind of thing?

You can do it quite easily with Nix (which you can use alongside your
normal package manager without interference, if you're not on NixOS).
Type in your package's root directory:

    cabal2nix --shell > shell.nix

Then you can build your package with various compiler versions:

    nix-build shell.nix --argstr compiler ghc803
    nix-build shell.nix --argstr compiler ghc7103
    nix-build shell.nix --argstr compiler ghcjs

If a build is successful, you will get a symlink called 'result', which
points to an installed version if your package including documentation.
Once you're done testing, just delete that link.

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.


_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Loading...