compiling-to-categories / concat

Compiling to Categories
http://conal.net/papers/compiling-to-categories
BSD 3-Clause "New" or "Revised" License
431 stars 49 forks source link

Support compilation on GHC 8.6 #47

Closed adamgundry closed 5 years ago

adamgundry commented 5 years ago

This makes it possible to build at least concat-examples and its dependencies with the GHC 8.6 beta release. I believe it should now build with 8.0 or later (earlier versions are not supported, please let me know if this is a problem).

To find a build plan it is necessary to specify allow-newer: base, ghc, Cabal, stm because not all dependencies have been updated yet. In addition the vector-sized package needs a tiny fix to build on 8.6, see expipiplus1/vector-sized#48.

The verilog package, a dependency of concat-hardware, doesn't build with GHC 8.4 or later. Should concat-hardware be marked as unbuildable? (This is similar to the situation with concat-graphics due to language-glsl, see #45.)

There are two failures due to unexpected output in gold-tests on 8.6, see here for details. It's possible that these are harmless changes, I'm not familiar enough with the code, but the differences in complex-mul-syn look non-trivial.

In 4490d14 I introduced an explicit call to error in place of the previous partial pattern match. Presumably this case doesn't arise in practice, but I thought it should be pointed out.

In 6f98f47 I specify that the plugins should never force recompilation, using the new machinery in GHC 8.6. Is this correct? It may be that a finer-grained recompilation check is needed; I'm not sufficiently familiar with the plugins to know.

conal commented 5 years ago

Wow. Great stuff. Thanks a bunch, Adam! I've tested with GHCs 8.0.2, 8.2.2, and 8.4.3, and all looks fine. How are you testing with GHC 8.6?

adamgundry commented 5 years ago

I'm using the 8.6.1 release candidate (actually 8.6.0.20180823) from hvr's PPA along with a cabal.project.local that specifies the allow-newer options I mentioned above. I checked out vector-sized locally with https://github.com/expipiplus1/vector-sized/pull/48/commits/8c8d6942dc856722bfd47d2ace137cf6dbca12a9 and pointed to it from cabal.project.

On the subject of testing, I'm wondering if it is desirable to get better coverage using Travis CI. At the moment it seems only GHC 8.0.2 is used, and the tests aren't built/executed. Is there any reason we can't build with multiple GHC versions as far as possible (modulo unsupported dependencies), running the tests but not failing the build for "expected" golden test failures? Would it be helpful if I worked up a PR to adjust the Travis config?

conal commented 5 years ago

Thanks for the explanation, @adamgundry. I had not heard of cabal.project or cabal.project.local files. I guess I'm behind the times. A few questions:

I'm all for improved testing. I know next to nothing about Travis. The setup I use now came from someone else. Yes, please do rework the testing as you think best, especially if you can try it yourself to make sure it works and that it's practical to use. I'm a little concerned about testing taking too long to be useful if we use multiple compilers and gold tests, but I'm eager for advice and help.

adamgundry commented 5 years ago

Ah, sorry, since there was a cabal.project file in the repo and it was used in the CI I assumed too much familiarity! These are indeed a new feature of cabal-install 2.0, and they make it much easier to work with multiple packages simultaneously across multiple GHC versions, using cabal new-build. There is certainly some overlap with what can be specified in a stack.yaml file, but it's not a precise mapping.

To some extent new-build is still being polished, and it requires learning slightly different workflows, so I wouldn't universally recommend switching from Stack at the moment. For example, specifying a dependency based on a Git commit is possible only in the latest development version of cabal-install.

I'll take a look at the testing/CI setup. I can also try to come up with an alternative stack.yaml for use on GHC 8.6 (e.g. addressing the vector-sized issue).

conal commented 5 years ago

Thanks for the tips about cabal-install 2.0.

Funny. I'd forgotten or maybe hadn't noticed that cabal.project file. Probably the only file in the repo I've not read or written.

I've pinged @expipiplus1 via email about your pull request. Perhaps he'll merge your PR soon.

conal commented 5 years ago

@adamgundry We're now getting vector-sized from GitHub, including the merge of your PR needed for GHC 8.6.

conal commented 5 years ago

@adamgundry AFAICT, the verilog package is building under 8.4.3. Are you seeing something different?

adamgundry commented 5 years ago

Sorry, my mistake, I was missing your commit to verilog that fixes the build under 8.4.3. Thanks for making the vector-sized related changes.