find module of `fromJust Nothing'

Serge D. Mechveliani mechvel at
Mon Nov 13 08:17:16 EST 2006

On Mon, Nov 13, 2006 at 12:17:07PM +0000, Simon Peyton-Jones wrote:

> The "Maybe.fromJust: Nothing" comes from the library code itself.
> The "Nat1" part is simply the name of the binary.  It give no clue to 
> who called fromJust.

I do not understand the whole idea.
First, the same problem is for many functions:  head, tail, and others.
Also I remember that in some cases GHC reports at  run-time  something 
like this:
  unexhaustive pattern corresponding to the line  No ... in the module ...

, and this helps a lot.
If an error of kind  (f _)  appears in the GHC library function  f, 
the run-time system, probably recalls who had called for  f,
because it stores the stack of calls, etc, I do not know ... 

> Finding who called fromJust is an often-requested feature eg 
> tp://  Currently our best answer 
>  to try with the -xc flag (involves recompiling)
> The Haskellwiki debugging page could perhaps mention the -xc thing.  
> I had trouble even finding the page from the home page.   

I do not know what is wiki.
Is not this sufficient to look into the GHC User Guide for  -xc  ?

So far, I only tried   ghc $dmCpOpt -xc --make Nat1
and obtained
                       ghc-6.6: unrecognised flags: -xc

Then, tried   ./Nat1 +RTS -xc -RTS
and obtained
              not built for: -prof   ...

So:  to re-make all the project for profiling, and then to try

            ./Nat1 +RTS -pT -xc -RTS

Serge Mechveliani
mechvel at

More information about the Glasgow-haskell-users mailing list