What prevents elm-platform from using Haskell 8?

When I follow thebuild from source installation directions, elm-platform rejects my ghc as being too new:

$ runhaskell installers/BuildFromSource.hs 0.17
You need GHC 7.10 to build this version of Elm.
You are using GHC 8.2 instead.

Out of curiosity, I hacked BuildFromSource.hs to allow my Haskell 8.2, and got the below errors, but I don’t know enough about the Haskell / Elm ecosystem to interpret them. Is this something that can be fixed by me?

$ runhaskell installers/BuildFromSource.hs master
Using GHC 8.2
Using Cabal 2.0.0.1

Cloning into 'elm-compiler'...
remote: Counting objects: 28784, done.
remote: Compressing objects: 100% (540/540), done.
remote: Total 28784 (delta 695), reused 778 (delta 476), pack-reused 27755
Receiving objects: 100% (28784/28784), 7.56 MiB | 2.06 MiB/s, done.
Resolving deltas: 100% (18141/18141), done.
Cloning into 'elm-package'...
remote: Counting objects: 3707, done.
remote: Total 3707 (delta 0), reused 0 (delta 0), pack-reused 3707
Receiving objects: 100% (3707/3707), 698.33 KiB | 99.00 KiB/s, done.
Resolving deltas: 100% (2204/2204), done.
Cloning into 'elm-make'...
remote: Counting objects: 1051, done.
remote: Total 1051 (delta 0), reused 0 (delta 0), pack-reused 1051
Receiving objects: 100% (1051/1051), 218.07 KiB | 155.00 KiB/s, done.
Resolving deltas: 100% (706/706), done.
Cloning into 'elm-reactor'...
remote: Counting objects: 3396, done.
remote: Total 3396 (delta 0), reused 0 (delta 0), pack-reused 3396
Receiving objects: 100% (3396/3396), 1.92 MiB | 105.00 KiB/s, done.
Resolving deltas: 100% (1948/1948), done.
Cloning into 'elm-repl'...
remote: Counting objects: 995, done.
remote: Total 995 (delta 0), reused 0 (delta 0), pack-reused 995
Receiving objects: 100% (995/995), 175.06 KiB | 762.00 KiB/s, done.
Resolving deltas: 100% (615/615), done.
Config file path source is default config file.
Config file /home/buck/.cabal/config not found.
Writing default configuration to /home/buck/.cabal/config
Downloading the latest package list from hackage.haskell.org
Writing a default package environment file to
/home/buck/repos/elm-platform/Elm-Platform/master/cabal.sandbox.config
Creating a new sandbox at
/home/buck/repos/elm-platform/Elm-Platform/master/.cabal-sandbox
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: base-4.10.1.0/installed-4.1... (dependency of elm-compiler-0.19.0)
next goal: elm-make (user goal)
rejecting: elm-make-0.18 (conflict: elm-compiler==0.19.0, elm-make =>
elm-compiler==0.18)
rejecting: elm-make-0.1.2 (conflict: elm-compiler==0.19.0, elm-make =>
elm-compiler>=0.15 && <0.16)
rejecting: elm-make-0.1.1 (conflict: elm-compiler==0.19.0, elm-make =>
elm-compiler>=0.14.1 && <0.15)
trying: elm-make-0.1
next goal: optparse-applicative (dependency of elm-make-0.1)
rejecting: optparse-applicative-0.14.0.0, optparse-applicative-0.13.2.0,
optparse-applicative-0.13.1.0, optparse-applicative-0.13.0.0,
optparse-applicative-0.12.1.0, optparse-applicative-0.12.0.0,
optparse-applicative-0.11.0.2, optparse-applicative-0.11.0.1,
optparse-applicative-0.11.0 (conflict: elm-make => optparse-applicative>=0.10
&& <0.11)
rejecting: optparse-applicative-0.10.0 (conflict:
base==4.10.1.0/installed-4.1..., optparse-applicative => base>=4 && <4.8)
rejecting: optparse-applicative-0.9.1.1, optparse-applicative-0.9.1,
optparse-applicative-0.9.0, optparse-applicative-0.8.1,
optparse-applicative-0.8.0.1, optparse-applicative-0.8.0,
optparse-applicative-0.7.0.2, optparse-applicative-0.7.0.1,
optparse-applicative-0.7.0, optparse-applicative-0.6.0,
optparse-applicative-0.5.2.1, optparse-applicative-0.5.2,
optparse-applicative-0.5.1, optparse-applicative-0.5.0,
optparse-applicative-0.4.3, optparse-applicative-0.4.2,
optparse-applicative-0.4.1, optparse-applicative-0.4.0,
optparse-applicative-0.3.2, optparse-applicative-0.3.1,
optparse-applicative-0.3.0, optparse-applicative-0.2.0,
optparse-applicative-0.1.1, optparse-applicative-0.1.0,
optparse-applicative-0.0.1 (conflict: elm-make => optparse-applicative>=0.10
&& <0.11)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: elm-make, optparse-applicative, base,
elm-compiler
Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unregistering the offending packages or
recreating the sandbox.
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: base-4.10.1.0/installed-4.1... (dependency of elm-compiler-0.19.0)
next goal: elm-make (user goal)
rejecting: elm-make-0.18 (conflict: elm-compiler==0.19.0, elm-make =>
elm-compiler==0.18)
rejecting: elm-make-0.1.2 (conflict: elm-compiler==0.19.0, elm-make =>
elm-compiler>=0.15 && <0.16)
rejecting: elm-make-0.1.1 (conflict: elm-compiler==0.19.0, elm-make =>
elm-compiler>=0.14.1 && <0.15)
trying: elm-make-0.1
next goal: optparse-applicative (dependency of elm-make-0.1)
rejecting: optparse-applicative-0.14.0.0, optparse-applicative-0.13.2.0,
optparse-applicative-0.13.1.0, optparse-applicative-0.13.0.0,
optparse-applicative-0.12.1.0, optparse-applicative-0.12.0.0,
optparse-applicative-0.11.0.2, optparse-applicative-0.11.0.1,
optparse-applicative-0.11.0 (conflict: elm-make => optparse-applicative>=0.10
&& <0.11)
rejecting: optparse-applicative-0.10.0 (conflict:
base==4.10.1.0/installed-4.1..., optparse-applicative => base>=4 && <4.8)
rejecting: optparse-applicative-0.9.1.1, optparse-applicative-0.9.1,
optparse-applicative-0.9.0, optparse-applicative-0.8.1,
optparse-applicative-0.8.0.1, optparse-applicative-0.8.0,
optparse-applicative-0.7.0.2, optparse-applicative-0.7.0.1,
optparse-applicative-0.7.0, optparse-applicative-0.6.0,
optparse-applicative-0.5.2.1, optparse-applicative-0.5.2,
optparse-applicative-0.5.1, optparse-applicative-0.5.0,
optparse-applicative-0.4.3, optparse-applicative-0.4.2,
optparse-applicative-0.4.1, optparse-applicative-0.4.0,
optparse-applicative-0.3.2, optparse-applicative-0.3.1,
optparse-applicative-0.3.0, optparse-applicative-0.2.0,
optparse-applicative-0.1.1, optparse-applicative-0.1.0,
optparse-applicative-0.0.1 (conflict: elm-make => optparse-applicative>=0.10
&& <0.11)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: elm-make, optparse-applicative, base,
elm-compiler
Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unregistering the offending packages or
recreating the sandbox.
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: elm-reactor-0.18 (user goal)
trying: binary-0.8.5.1/installed-0.8... (dependency of scientific-0.3.5.2)
next goal: elm-package (dependency of elm-reactor-0.18)
rejecting: elm-package-0.18, elm-package-0.5, elm-package-0.4,
elm-package-0.2.2, elm-package-0.2.1, elm-package-0.2 (conflict:
binary==0.8.5.1/installed-0.8..., elm-package => binary>=0.7 && <0.8)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: primitive, vector, base, elm-reactor,
transformers, elm-compiler, Elm, elm-package
Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unregistering the offending packages or
recreating the sandbox.

If I read this correctly, you’re not just building with GHC 8.2, you’re also building the in-development elm version 0.19. And it’s not finding elm-make 0.19 to go with elm-compiler 0.19.

If you’re determined to keep going with this, how about trying to build 0.17 or 0.18 first (i.e., keep the 0.17 argument instead of master)?

Thanks @rob. I’m trying that now. My reasoning was that, potentially, master branch has some new support for Haskell 8. I see that it cloned elm-make before it failed to find elm-make. Is that not the same one it’s supposed to find?

I got a very similar error when trying “0.18”:

Downloading the latest package list from hackage.haskell.org
Writing a default package environment file to
/home/buck/repos/elm-platform/Elm-Platform/0.18/cabal.sandbox.config
Creating a new sandbox at
/home/buck/repos/elm-platform/Elm-Platform/0.18/.cabal-sandbox
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: transformers-0.5.2.0/installed-0.5... (dependency of union-find-0.2)
trying: elm-make-0.18 (user goal)
next goal: optparse-applicative (dependency of elm-make-0.18)
rejecting: optparse-applicative-0.14.0.0, optparse-applicative-0.13.2.0,
optparse-applicative-0.13.1.0, optparse-applicative-0.13.0.0,
optparse-applicative-0.12.1.0, optparse-applicative-0.12.0.0 (conflict:
elm-make => optparse-applicative>=0.11 && <0.12)
rejecting: optparse-applicative-0.11.0.2, optparse-applicative-0.11.0.1,
optparse-applicative-0.11.0 (conflict: transformers==0.5.2.0/installed-0.5...,
optparse-applicative => transformers>=0.2 && <0.5)
rejecting: optparse-applicative-0.10.0, optparse-applicative-0.9.1.1,

When trying “0.17.1”:

Downloading the latest package list from hackage.haskell.org
Writing a default package environment file to
/home/buck/repos/elm-platform/Elm-Platform/0.17.1/cabal.sandbox.config
Creating a new sandbox at
/home/buck/repos/elm-platform/Elm-Platform/0.17.1/.cabal-sandbox
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: transformers-0.5.2.0/installed-0.5... (dependency of union-find-0.2)
trying: elm-make-0.17.1 (user goal)
next goal: optparse-applicative (dependency of elm-make-0.17.1)
rejecting: optparse-applicative-0.14.0.0, optparse-applicative-0.13.2.0,
optparse-applicative-0.13.1.0, optparse-applicative-0.13.0.0,
optparse-applicative-0.12.1.0, optparse-applicative-0.12.0.0 (conflict:
elm-make => optparse-applicative>=0.11 && <0.12)

When trying “0.17”:

Downloading the latest package list from hackage.haskell.org
Writing a default package environment file to
/home/buck/repos/elm-platform/Elm-Platform/0.17.1/cabal.sandbox.config
Creating a new sandbox at
/home/buck/repos/elm-platform/Elm-Platform/0.17.1/.cabal-sandbox
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: transformers-0.5.2.0/installed-0.5... (dependency of union-find-0.2)
trying: elm-make-0.17.1 (user goal)
next goal: optparse-applicative (dependency of elm-make-0.17.1)
rejecting: optparse-applicative-0.14.0.0, optparse-applicative-0.13.2.0,
optparse-applicative-0.13.1.0, optparse-applicative-0.13.0.0,
optparse-applicative-0.12.1.0, optparse-applicative-0.12.0.0 (conflict:
elm-make => optparse-applicative>=0.11 && <0.12)

But this is much better! Now you’re getting a proper version of elm-make (e.g., elm-make-0.18; before you had elm-make-0.1). I think the actual problem should be lower in your output. Chances are that some dependencies are rejected because GHC 8 comes with a new version of the base package. If that’s the case and you wanted to continue, the next step would be relaxing the version bounds in the cabal files.

By the way judging by the travis config in elm-lang/elm-compiler, the development version is also being built with GHC 7.10, so it seems unlikely that master will be any easier here.

Here’s the full message, below. It’s so long, I thought I’d try to shorten it to the most relevant bit, but it’s apparent I don’t know how :smiley:

$ runhaskell installers/BuildFromSource.hs 0.18
Using GHC 8.2
Using Cabal 2.0.0.1

fatal: destination path 'elm-compiler' already exists and is not an empty directory.
fatal: destination path 'elm-package' already exists and is not an empty directory.
fatal: destination path 'elm-make' already exists and is not an empty directory.
fatal: destination path 'elm-reactor' already exists and is not an empty directory.
fatal: destination path 'elm-repl' already exists and is not an empty directory.
Downloading the latest package list from hackage.haskell.org
Writing a default package environment file to
/home/buck/repos/elm-platform/Elm-Platform/0.18/cabal.sandbox.config
Using an existing sandbox located at
/home/buck/repos/elm-platform/Elm-Platform/0.18/.cabal-sandbox
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: transformers-0.5.2.0/installed-0.5... (dependency of union-find-0.2)
trying: elm-make-0.18 (user goal)
next goal: optparse-applicative (dependency of elm-make-0.18)
rejecting: optparse-applicative-0.14.0.0, optparse-applicative-0.13.2.0,
optparse-applicative-0.13.1.0, optparse-applicative-0.13.0.0,
optparse-applicative-0.12.1.0, optparse-applicative-0.12.0.0 (conflict:
elm-make => optparse-applicative>=0.11 && <0.12)
rejecting: optparse-applicative-0.11.0.2, optparse-applicative-0.11.0.1,
optparse-applicative-0.11.0 (conflict: transformers==0.5.2.0/installed-0.5...,
optparse-applicative => transformers>=0.2 && <0.5)
rejecting: optparse-applicative-0.10.0, optparse-applicative-0.9.1.1,
optparse-applicative-0.9.1, optparse-applicative-0.9.0,
optparse-applicative-0.8.1, optparse-applicative-0.8.0.1,
optparse-applicative-0.8.0, optparse-applicative-0.7.0.2,
optparse-applicative-0.7.0.1, optparse-applicative-0.7.0,
optparse-applicative-0.6.0, optparse-applicative-0.5.2.1,
optparse-applicative-0.5.2, optparse-applicative-0.5.1,
optparse-applicative-0.5.0, optparse-applicative-0.4.3,
optparse-applicative-0.4.2, optparse-applicative-0.4.1,
optparse-applicative-0.4.0, optparse-applicative-0.3.2,
optparse-applicative-0.3.1, optparse-applicative-0.3.0,
optparse-applicative-0.2.0, optparse-applicative-0.1.1,
optparse-applicative-0.1.0, optparse-applicative-0.0.1 (conflict: elm-make =>
optparse-applicative>=0.11 && <0.12)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: optparse-applicative, elm-make, base,
elm-compiler, transformers, union-find
Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unregistering the offending packages or
recreating the sandbox.
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: transformers-0.5.2.0/installed-0.5... (dependency of union-find-0.2)
trying: elm-make-0.18 (user goal)
next goal: optparse-applicative (dependency of elm-make-0.18)
rejecting: optparse-applicative-0.14.0.0, optparse-applicative-0.13.2.0,
optparse-applicative-0.13.1.0, optparse-applicative-0.13.0.0,
optparse-applicative-0.12.1.0, optparse-applicative-0.12.0.0 (conflict:
elm-make => optparse-applicative>=0.11 && <0.12)
rejecting: optparse-applicative-0.11.0.2, optparse-applicative-0.11.0.1,
optparse-applicative-0.11.0 (conflict: transformers==0.5.2.0/installed-0.5...,
optparse-applicative => transformers>=0.2 && <0.5)
rejecting: optparse-applicative-0.10.0, optparse-applicative-0.9.1.1,
optparse-applicative-0.9.1, optparse-applicative-0.9.0,
optparse-applicative-0.8.1, optparse-applicative-0.8.0.1,
optparse-applicative-0.8.0, optparse-applicative-0.7.0.2,
optparse-applicative-0.7.0.1, optparse-applicative-0.7.0,
optparse-applicative-0.6.0, optparse-applicative-0.5.2.1,
optparse-applicative-0.5.2, optparse-applicative-0.5.1,
optparse-applicative-0.5.0, optparse-applicative-0.4.3,
optparse-applicative-0.4.2, optparse-applicative-0.4.1,
optparse-applicative-0.4.0, optparse-applicative-0.3.2,
optparse-applicative-0.3.1, optparse-applicative-0.3.0,
optparse-applicative-0.2.0, optparse-applicative-0.1.1,
optparse-applicative-0.1.0, optparse-applicative-0.0.1 (conflict: elm-make =>
optparse-applicative>=0.11 && <0.12)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: optparse-applicative, elm-make, base,
elm-compiler, transformers, union-find
Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unregistering the offending packages or
recreating the sandbox.
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: elm-reactor-0.18 (user goal)
trying: binary-0.8.5.1/installed-0.8... (dependency of scientific-0.3.5.2)
next goal: elm-package (dependency of elm-reactor-0.18)
rejecting: elm-package-0.18, elm-package-0.5, elm-package-0.4,
elm-package-0.2.2, elm-package-0.2.1, elm-package-0.2 (conflict:
binary==0.8.5.1/installed-0.8..., elm-package => binary>=0.7 && <0.8)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: primitive, vector, base, elm-reactor,
transformers, elm-compiler, Elm, elm-package
Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unregistering the offending packages or
recreating the sandbox.

These were the changes that I had to make to the 0.18 cabal files to get things to install. I don’t know if this will break things (probably!). I plan to try it and see.

diff --git a/elm-make.cabal b/elm-make.cabal
index f49ba94..62bc4d8 100644
--- a/elm-make.cabal
+++ b/elm-make.cabal
@@ -67,7 +67,7 @@ Executable elm-make
         elm-package,
         filepath,
         mtl >= 2.2.1 && < 3,
-        optparse-applicative >=0.11 && <0.12,
+        optparse-applicative >=0.11 && <0.14,
         raw-strings-qq,
         time,
         text
diff --git a/elm-package.cabal b/elm-package.cabal
index 4d64628..e91b906 100644
--- a/elm-package.cabal
+++ b/elm-package.cabal
@@ -67,7 +67,7 @@ Library
         edit-distance,
         elm-compiler == 0.18,
         filepath >= 1 && < 2.0,
-        HTTP >= 4000.2.5 && < 4000.3,
+        HTTP >= 4000.2.5 && < 4000.4,
         http-client >= 0.4.15 && < 0.5,
         http-client-tls >= 0.2 && < 0.3,
         http-types >= 0.7 && < 0.9,
@@ -77,7 +77,7 @@ Library
         text,
         time,
         unordered-containers,
-        vector >= 0.10 && < 0.12,
+        vector >= 0.10 && < 0.13,
         zip-archive
 
 
@@ -131,17 +131,17 @@ Executable elm-package
         edit-distance,
         elm-compiler == 0.18,
         filepath >= 1 && < 2.0,
-        HTTP >= 4000.2.5 && < 4000.3,
+        HTTP >= 4000.2.5 && < 4000.4,
         http-client >= 0.3 && < 0.5,
         http-client-tls >= 0.2 && < 0.3,
         http-types >= 0.7 && < 0.9,
         mtl >= 2 && < 3,
         network >= 2.4 && < 2.7,
-        optparse-applicative >= 0.11 && < 0.12,
+        optparse-applicative >= 0.11 && < 0.14,
         parallel-io,
         pretty,
         text,
         time,
         unordered-containers,
-        vector >= 0.10 && < 0.12,
+        vector >= 0.10 && < 0.13,
         zip-archive

Attempting to install Elm 0.18, using the above modifications, gives this result: https://gist.github.com/bukzor/37dd35cb0a4e553e85e8f0a0f282432b. I’m going to give up now and install GHC 7. As a parting though, I see that the Elm recipe in Homebrew uses GHC 8.0 to install Elm from source. Are all the problems I’m finding here specific to 8.2 but not 8.0?

Building executable 'elm-package' for elm-package-0.18..
[27 of 27] Compiling Utils.Paths      ( src/Utils/Paths.hs, dist/dist-sandbox-ca0311fe/build/elm-package/elm-package-tmp/Utils/Paths.o )

src/Utils/Paths.hs:15:27: error:
    Not in scope: ‘N.toFilePath’
    No module named ‘N’ is imported.
   |
15 | library name = libDir </> N.toFilePath name
   |                           ^^^^^^^^^^^^

src/Utils/Paths.hs:19:26: error:
    Not in scope: ‘Package.versiontoString’
    Perhaps you meant one of these:
      ‘Package.versionToString’ (imported from Elm.Package),
      ‘Package.versionFromString’ (imported from Elm.Package)
    Module ‘Elm.Package’ does not export ‘versiontoString’.
   |
19 |         library name </> Package.versiontoString version
| ^^^^^^^^^^^^^^^^^^^^^^^
1 Like

Progress!

Those are some pretty straightforward errors, seems like that code was never compiled since 2015? Weird. Here’s an untested patch. Would you mind giving it a go?

The nix expression for elm also uses something newer than upstream – in its case, 8.0.2. Maybe that’ll be of some help?

(Note, there was also some discussion of this at https://github.com/elm-lang/elm-compiler/issues/1566 – word there was that building with something newer than 7.10 is not a high priority right now.)