[Haskell-beginners] haskell error message

Daniel Fischer daniel.is.fischer at googlemail.com
Mon Aug 29 13:56:34 CEST 2011


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.




More information about the Beginners mailing list