haskell error message

Hi everybody, can somebody explain as to what the following error message means.. [1 of 1] Compiling Main ( main.hs, main.o ) SpecConstr Function `$wf{v s3mp} [lid]' has four call patterns, but the limit is 3 Use -fspec-constr-count=n to set the bound Use -dppr-debug to see specialisations SpecConstr Function `$wf{v X3sC} [lid]' has three call patterns, but the limit is 1 Use -fspec-constr-count=n to set the bound Use -dppr-debug to see specialisations Linking main ... Thanks, Sunil.

On Monday 29 August 2011, 13:15:37, Sunil S Nandihalli wrote:
Hi everybody, can somebody explain as to what the following error message means..
Fortunately, it's not an error message, not even a serious warning. It shouldn't really be shown to the user unless (s)he asks the compiler to be really thorough in reporting "problems". The thing is, with optimisations (I'm not sure whether -O suffices or one needs -O2) GHC specialises functions by call pattern, meaning, by the constructors of the arguments. The number of possible specialisations can become huge for recursive functions, so there's a limit how many specialisations GHC will create for any function - the default limit is, iirc, 3 - and when specialising a callee, the limit is divided by the number of specialisations of the caller so you don't get exponential code growth. Now
[1 of 1] Compiling Main ( main.hs, main.o ) SpecConstr Function `$wf{v s3mp} [lid]' has four call patterns, but the limit is 3 Use -fspec-constr-count=n to set the bound Use -dppr-debug to see specialisations SpecConstr Function `$wf{v X3sC} [lid]' has three call patterns, but the limit is 1 Use -fspec-constr-count=n to set the bound Use -dppr-debug to see specialisations
means that these functions have more call patterns to specialise for than the current limit allows, so GHC doesn't create these specialisations. The first seems to be a first-generation specialisation candidate and the second a second-generation candidate since its limit has dropped to 1. It's nothing serious, just a possible missed optimisation [that can have a big impact, but normally it doesn't make too much difference; on the other hand, occasionally the constructor specialisation is a pessimisation, so you can turn it off with -fno-spec-constr]. If you set the limit high enough with -fspec-constr-count=n, GHC will create all specialisations it thinks will be good and doesn't lose a word about it. Really, it shouldn't reach the console unless the user asks for it, but somebody forgot to remove it from the diagnostics by default.
Linking main ...
Thanks, Sunil.

Daniel, Thanks a lot for the answer, I was about to ask a similar question just now. One more question though, I found documentation about this and tried setting -fspec-constr-count=10 in my cabal file under ghc-options, but it didn't seem to make a difference. The compiler still generates the warning. Why do you think this can be? Best, Ozgur

On Monday 29 August 2011, 15:00:19, Ozgur Akgun wrote:
Daniel,
Thanks a lot for the answer, I was about to ask a similar question just now.
One more question though, I found documentation about this and tried setting -fspec-constr-count=10 in my cabal file under ghc-options, but it didn't seem to make a difference. The compiler still generates the warning.
Why do you think this can be?
Too large fan-out, probably. Try a larger value or use the sledgehammer method and turn off the limit: -fno-spec-constr-count
Best, Ozgur

On 29 August 2011 14:20, Daniel Fischer
Try a larger value or use the sledgehammer method and turn off the limit: -fno-spec-constr-count
Yes I tried this and it removes the warnings. Strangest thing is, when I set -f-spec-constr-count to 10, the generated warning is "... has four call patterns, but the limit is 3 ...". Somehow it doesn't say the limit is 10. Ozgur

On Monday 29 August 2011, 15:31:09, Ozgur Akgun wrote:
On 29 August 2011 14:20, Daniel Fischer
wrote: Try a larger value or use the sledgehammer method and turn off the limit: -fno-spec-constr-count
Yes I tried this and it removes the warnings.
Strangest thing is, when I set -f-spec-constr-count to 10, the generated warning is "... has four call patterns, but the limit is 3 ...". Somehow it doesn't say the limit is 10.
Second generation. You have a function with three call patterns (and no previous constructor specialisation), limit is 10, fine, specialise. This function calls a worker. Now, since we had three specialisations above, the limit here is 10 `div` 3 = 3. The worker would have four call patterns; 4 > 3 => message "Hi there, I could have done more, but the limit said I shouldn't. You might want to set a higher limit if you think it's worthwhile to specialise." Cheers, Daniel

Thanks a lot Daniel, great explanation!
On 29 August 2011 14:49, Daniel Fischer
You have a function with three call patterns (and no previous constructor specialisation), limit is 10, fine, specialise.
This function calls a worker. Now, since we had three specialisations above, the limit here is 10 `div` 3 = 3. The worker would have four call patterns; 4 > 3 => message "Hi there, I could have done more, but the limit said I shouldn't. You might want to set a higher limit if you think it's worthwhile to specialise."
Ozgur

Thanks a lot Daniel.
Sunil.
On Mon, Aug 29, 2011 at 7:27 PM, Ozgur Akgun
Thanks a lot Daniel, great explanation!
On 29 August 2011 14:49, Daniel Fischer
wrote: You have a function with three call patterns (and no previous constructor specialisation), limit is 10, fine, specialise.
This function calls a worker. Now, since we had three specialisations above, the limit here is 10 `div` 3 = 3. The worker would have four call patterns; 4 > 3 => message "Hi there, I could have done more, but the limit said I shouldn't. You might want to set a higher limit if you think it's worthwhile to specialise."
Ozgur
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
participants (3)
-
Daniel Fischer
-
Ozgur Akgun
-
Sunil S Nandihalli