-
Notifications
You must be signed in to change notification settings - Fork 20
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
Fix build issue under ghc 7.10-rc3 #140
Conversation
Add FlexibleContexts to remove error at line 48 (in derived type, in the constraint IsString [a])
Thanks! I mean, I don't think this is the right fix, but thanks for bringing my attention to it. Line 48 is a function without a type signature:
Which should have required FlexibleContexts in any version of ghc, so I don't understand how this ever compiled. Since I am familiar with the source, I know that the second branch is supposed to be examining a
|
Also, did you have to use special versions of some of the dependencies? I'm trying out ghc-7.10-rc2 in order to test your change and mine, but stringsearch-0.3.6.5's build also complains about needing FlexibleContexts. |
In that case, yes, making the type specific is the correct fix.
Yes, I had to manually patch some of the dependencies:
|
Adding FlexibleContext to stringsearch doesn't look like the right fix either. Let's look at a simplified version of the problematic function:
The first error message complains about an ambiguity in the line which creates
I believe those two potential instances are, respectively, for an unboxed and a boxed array. The unboxed array will be faster, and since the call to But I don't understand how adding The definition of
Since
I can't add this type signature directly because the
Is it also you who has submitted the FlexibleContext fix for stringsearch? I'd like to submit my counter-proposal there. |
No, I sourced my patch from that issue. You seem far more familiar with GHC extensions than me; I wish I had just opened an issue now. suffShifts :: S.ByteString -> UArray Int Int The first error message complains about an ambiguity in the line which creates ar: Data/ByteString/Search/Internal/Utils.hs:184:11: I believe those two potential instances are, respectively, for an unboxed and a boxed array. The unboxed array will be faster, and since the call to newArray is inside a runSTUArray block, it seems clear that it's the STUArray version which was intended. But I don't understand how adding FlexibleContexts could fix that error message. In fact, I don't understand why there is any ambiguity at all: runSTUArray expects an ST computation returning an STUArray. Shouldn't that fix the type of ar? Well, only if ar is the value which is returned from the block. The block ends with a call to sufShift, a helper function which lacks a type signature. That's probably the cause of the problem. The definition of sufShift has another error message, the one which probably prompted you to add FlexibleContexts: Non type-variable argument in the constraint: MArray a_a4JF Int m Since sufShift is the last action of the runSTUArray block, we know that m (a0 Int Int) is supposed to match ST s (STUArray s i e), so the concrete type of sufShift is: sufShift :: Int -> ST s (STUArray s Int Int) I can't add this type signature directly because the s must be the same as the one which was used to create ar. So instead of adding FlexibleContext, I add ScopedTypeVariables and I give a type to the runSTUArray block, thereby placing s into scope: suffShifts :: S.ByteString -> UArray Int Int Is it also you who has submitted the FlexibleContext fix for stringsearch? I'd like to submit my counter-proposal there. —Reply to this email directly or view it on GitHub. |
gelisam wrote (emphasis mine),
The last sentence is where the reasoning breaks down. Before GHC 7.10 the compiler would happily accept terms of types which require extensions so long as you didn't actually write a type signature. The change is that the compiler now requires |
Thanks for the clarification, I was wondering what had changed. |
I finally managed to get Hawk to compile with ghc 7.10.1-rc2, so I'll close this. For future reference, my steps were:
|
I've only tested with ghc 7.10rc2, not 7.10rc3, I hope that's close enough.
In order to also run the tests with ghc 7.10, I had to do the following extra steps.
|
Add
FlexibleContexts
to Data.HaskellModule.Parse to remove error at line 48 (in derived type, in the constraint IsString [a]).There is another build issue, but I believe it to be out of your control: dependencies fail as MonadCatchIO-transformers==0.3.1.0 has the upper bound
base<4.8
.This appears to be the only change necessary for hawk to compile under ghc 7.10 (assuming you give cabal the --allow-newer flag. Unfortunately, I'm still struggling to install everything necessary for the test suite still, so can't give feedback there yet, or run the suite to check everything is still working fine.