-xc giving very little information

Simon Marlow simonmar at microsoft.com
Mon Jan 5 13:28:15 EST 2004


 
> A complex program of mine fails with this message:
> 
> 	Fail: Maybe.fromJust: Nothing
> 
> I tried to extract more information about the error by compiling with 
> -prof -auto-all and running the program with +RTS -xc, as advised on 
> http://www.haskell.org/hawiki/TipsAndTricks . This yielded 
> exactly one 
> additional line:
> 
> <Data.Maybe.CAF>.
> Fail: Maybe.fromJust: Nothing
> 
> (Same result for GHC 6.0.1 and 6.2.)

That is rather unfortunate, but it's the "correct" behaviour.

fromJust is defined like this:

   fromJust Nothing = error "Maybe.fromJust: Nothing"
   fromJust (Just a) = a

and GHC has compiled it like this:

   _lift = error "Maybe.fromJust: Nothing"
   fromJust Nothing = _lift
   fromJust (Just a) = a

so that it can inline fromJust without creating too much code explosion.
Unfortunately, this means that _lift is a CAF, and all CAF evaluation
appears at the top level in the cost-centre-stack semantics (see the
section on profiling in the User's Guide for details).

There's no obvious way to work around this, I'm afraid.

Cheers,
	Simon


More information about the Glasgow-haskell-users mailing list