[Haskell-beginners] How to install new GHC ?

Michael Snoyman michael at snoyman.com
Tue Dec 12 14:50:18 UTC 2017


That's right, the template-haskell API frequently changes between major
releases of GHC.

On Tue, Dec 12, 2017, 4:35 PM Baa <aquagnu at gmail.com> wrote:

> @Michael Snoyman:
>
> I returned back all .cabal-files and added compiler: ghc-8.2.2, `stack
> build`
> printed out this:
>
> ---cut---
>   Error: While constructing the build plan, the following exceptions were
> encountered:
>
>   In the dependencies for Cabal-1.24.2.0:
>       process-1.6.1.0 from stack configuration does not match >=1.1.0.1 &&
> <1.5 (latest matching version is 1.4.3.0)
>   needed due to my-common-utils-0.2.0.0 -> Cabal-1.24.2.0
>
>   In the dependencies for versions-3.1.1:
>       base-4.10.1.0 from stack configuration does not match >=4.8 && <4.10
> (latest matching version is 4.9.1.0)
>   needed due to my-common-utils-0.2.0.0 -> versions-3.1.1
>
>   Some potential ways to resolve this:
>
>     * Recommended action: try adding the following to your extra-deps in
> /home/pavel/prj/automation/revcompl-mon/stack.yaml:
>
>   - base-4.9.1.0
>   - process-1.4.3.0
>
>     * Set 'allow-newer: true' to ignore all version constraints and build
> anyway.
>
>     * You may also want to try using the 'stack solver' command.
>
>   Plan construction failed.
> ---cut---
>
> After adding "allow-newer: true" build process starts, all looked fine
> until:
>
>    .../SimpleTagging.hs:281:51: error:
>         • Couldn't match type ‘Type’ with ‘DerivClause’
>           Expected type: [DerivClause]
>             Actual type: [Type]
>         • In the sixth argument of ‘DataD’, namely ‘derivs'’
>           In the expression: DataD [] ty' tyVars Nothing newCs derivs'
>           In the first argument of ‘(++)’, namely
>             ‘[DataD [] ty' tyVars Nothing newCs derivs']’
>         |
>     281 |       return $ [DataD [] ty' tyVars Nothing newCs derivs'] ++
> showInst
>         |                                                   ^^^^^^^
>
> which IMHO means that TemplateHaskell ("API") was changed from 8.0.2 to
> 8.2.2 because the same code is compiling with old GHC 8.0.2.
>
>
> > Hi Paul,
> >
> > A Stackage snapshot specifies both a GHC version and a set of
> > packages. Stackage snapshots are built and tested to ensure that the
> > packages are compatible. While you could tell Stack to use a
> > different GHC version with a snapshot[1], this is unlikely to work,
> > since GHC major releases usually break some packages.
> >
> > I think everyone who's trying to help you (both with Cabal and Stack
> > workflows) would be able to do so better if you explain which package
> > you're trying to use which is no longer available in Stackage
> > Nightly. In some cases, you can simply add it as an extra
> > dependencies for Stack (e.g., `extra-deps: [acme-missiles-0.3]`),
> > while in others there is some inherent incompatibility.
> >
> > Right now, you'll just be getting guesses about how to theoretically
> > get some unknown package to build with a bunch of others.
> >
> > Michael
> >
> > [1] Using a setting like `compiler: ghc-8.2.2`
> >
> > On Tue, Dec 12, 2017 at 3:43 PM, Baa <aquagnu at gmail.com> wrote:
> >
> > > @David: I tried to switch to nightly but in project's .yaml file and
> > > got error about missing of some library (as I understand, it is
> > > missing in last nightly). So, if I try to do it through .yaml file
> > > then how to use new GHC (8.2.2) but with LTS for 8.0.2? Is it
> > > possible? I need last stable LTS where all libraries (using in the
> > > projects) exist, but with new GHC 8.2.2 which is too new for stable
> > > LTS. As I read somewhere, GHC version and Stackage version are
> > > linked together hardly in stack tool, or?
> > >
> > > > You can see how to configure stack here:
> > > > https://github.com/commercialhaskell/stack/blob/release/doc/yaml_
> > > configuration.md
> > > >
> > > > The short of it is that to have stack ghci choose a particular
> > > > version of ghc, you probably need to modify
> > > > ~/.stack/global/stack.yaml, change resolver to something here
> > > > https://www.stackage.org/snapshots that has your version of ghc
> > > > and dependencies similar to what your project wants.  For example
> > > > 'nightly-2017-12-10'.
> > > >
> > > > On Tue, Dec 12, 2017 at 7:53 AM, Baa <aquagnu at gmail.com> wrote:
> > > >
> > > > > @Francesco: unfortunately nightly misses some package. So, I
> > > > > tried:
> > > > >
> > > > >   $ stack --resolver=ghc-8.2.2 setup --reinstall
> > > > >   Preparing to install GHC (tinfo6) to an isolated location.
> > > > > This will not interfere with any system-level installation.
> > > > > Already downloaded. Installed GHC.
> > > > >
> > > > >   stack will use a sandboxed GHC it installed
> > > > >   For more information on paths, see 'stack path' and 'stack
> > > > > exec env' To use this GHC and packages outside of a project,
> > > > > consider using: stack ghc, stack ghci, stack runghc, or stack
> > > > > exec
> > > > >
> > > > > So seems that 8.2.2 was installed, right? But how to build the
> > > > > project with new GHC now? I never used cabal before, `stack
> > > > > ghci` still runs 8.0.2 instead of 8.2.2. Installed GHC 8.2.2
> > > > > does not correspond to .yaml file LTS - maybe this is a reason
> > > > > why old 8.0.2 is stil used...
> > > > >
> > > > > When I try cabal build/new-build/repl I get:
> > > > >
> > > > >   cabal: The program 'ghc' version >=6.4 is required but it
> > > > > could not be found.
> > > > >
> > > > > So, cabal does not know about installed GHC versions (at least
> > > > > 8.0.2, used by stack). I tried --require-sandbox but without
> > > > > success.
> > > > >
> > > > >
> > > > > > On Tue, Dec 12, 2017 at 01:56:03PM +0200, Baa wrote:
> > > > > > > Would somebody explain me what is wrong here and how I can
> > > > > > > test a project with new 8.2.2 GHC?
> > > > > >
> > > > > > Hello Paul, I don't think stack lts has 8.2.2 just yet. Use a
> > > > > > nightly or download/install ghc from here and compile your
> > > > > > project with the new `cabal new-build`.
> > > > > >
> > > > > > [1]
> > > > > > https://www.haskell.org/ghc/download_ghc_8_2_2.html#binaries
> > > > > >
> > > > > >
> > > > > > _______________________________________________
> > > > > > Beginners mailing list
> > > > > > Beginners at haskell.org
> > > > > > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
> > > > >
> > > > > _______________________________________________
> > > > > Beginners mailing list
> > > > > Beginners at haskell.org
> > > > > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
> > > > >
> > >
> > > _______________________________________________
> > > Beginners mailing list
> > > Beginners at haskell.org
> > > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
> > >
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20171212/6965bd07/attachment-0001.html>


More information about the Beginners mailing list