Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails with GHC-7.8.4 and installed transformers #173

Open
phadej opened this issue Apr 26, 2018 · 9 comments
Open

Fails with GHC-7.8.4 and installed transformers #173

phadej opened this issue Apr 26, 2018 · 9 comments

Comments

@phadej
Copy link
Contributor

phadej commented Apr 26, 2018

% cabal new-build -w ghc-7.8.4 --constraint='transformers installed'
Build profile: -w ghc-7.8.4 -O1
In order, the following will be built (use -v for more details):
 - free-5.0.2 (lib) (first run)
Preprocessing library for free-5.0.2..
Building library for free-5.0.2..

In file included from src/Control/Applicative/Free.hs:9:0: 

include/free-common.h:15:0:
     error: missing binary operator before token "("
     #if MIN_VERSION_transformers_compat(0,5,0) && !MIN_VERSION_transformers(0,4,0)
@RyanGlScott
Copy link
Collaborator

See my comments here as to why this is happening.

@phadej
Copy link
Contributor Author

phadej commented Apr 27, 2018

@RyanGlScott I don't see how that is related. Note that in recent #172 transformers-compat dependency is removed completely.

@RyanGlScott
Copy link
Collaborator

RyanGlScott commented Apr 27, 2018

Let's take a closer look at the CPP:

#ifndef MIN_VERSION_base
#define MIN_VERSION_base(x,y,z) 1
#endif

#ifndef MIN_VERSION_mtl
#define MIN_VERSION_mtl(x,y,z) 1
#endif

#if MIN_VERSION_base(4,9,0)
...
#else
#if MIN_VERSION_transformers(0,5,0)
...
#else
#if MIN_VERSION_transformers_compat(0,5,0) && !MIN_VERSION_transformers(0,4,0)
...
#endif
#endif
#endif

GHC 7.8.4 comes bundled with base-4.7, so that first conditional (#if MIN_VERSION_base(4,9,0)) will fail. Then, it'll try the next conditional (#if MIN_VERSION_transformers_compat(0,5,0) && !MIN_VERSION_transformers(0,4,0)). But as you've noted, free no longer depends on transformers-compat, so this will fail to preprocess, as MIN_VERSION_transformers_compat is no longer defined.

In that case, I have to wonder if this CPP needs to be updated to reflect transformers-compat's removal?

@phadej
Copy link
Contributor Author

phadej commented Apr 27, 2018

diff --git a/include/free-common.h b/include/free-common.h
index 220394d..fdaa8bf 100644
--- a/include/free-common.h
+++ b/include/free-common.h
@@ -12,8 +12,5 @@
 #if MIN_VERSION_transformers(0,5,0)
 #define LIFTED_FUNCTOR_CLASSES 1
 #else
-#if MIN_VERSION_transformers_compat(0,5,0) && !MIN_VERSION_transformers(0,4,0)
-#define LIFTED_FUNCTOR_CLASSES 1
-#endif
 #endif
 #endif
% cabal new-build -w ghc-7.8.4 --constraint='transformers installed'
Build profile: -w ghc-7.8.4 -O1
In order, the following will be built (use -v for more details):
 - free-5.0.2 (lib) (first run)
Preprocessing library for free-5.0.2..
Building library for free-5.0.2..

src/Control/Monad/Free/Class.hs:44:8:
    Could not find module ‘Control.Monad.Trans.Except’
    It is a member of the hidden package ‘transformers-compat-0.6.1.3’.
    Perhaps you need to add ‘transformers-compat’ to the build-depends in your .cabal file.
    Use -v to see a list of the files searched for.

src/Data/Functor/Classes/Compat.hs:30:8:
    Could not find module ‘Data.Functor.Classes’
    It is a member of the hidden package ‘transformers-compat-0.6.1.3’.
    Perhaps you need to add ‘transformers-compat’ to the build-depends in your .cabal file.
    Use -v to see a list of the files searched for.

it's not about that CPP, the rest of free is broken too.

@RyanGlScott
Copy link
Collaborator

OK. In that case, I have to ask: why was the transformers-compat dependency removed in the first place? It seems like it was legitimately being used in various places.

@phadej
Copy link
Contributor Author

phadej commented Apr 27, 2018

I'm not the author of #172, ping @vmchale

@RyanGlScott
Copy link
Collaborator

RyanGlScott commented Apr 27, 2018

Would it suffice to just add:

if !impl(ghc >= 8.0)
  build-depends: transformers-compat >= 0.3 && < 1

Back to the .cabal file? If so, I could do this.

@phadej
Copy link
Contributor Author

phadej commented Apr 27, 2018

in recursion-schemes I'm a little more conservative,

https://github.com/ekmett/recursion-schemes/pull/46/files#diff-14ead692b66720cacc174e7be4d60386R61

I require that with GHC-7.10 we have at least transformers >= 0.4.2.0 (bundled one), and with older I require `transformers-compat. That's because one could also use older transformers than is bundled with GHC (It's stupid, but better to be explicit about that as we put right bounds in place).

@RyanGlScott
Copy link
Collaborator

OK, this is evidently more involved than I thought :)

Do you mind putting up a patch which does the right thing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants