locating fromJust Nothing

Serge D. Mechveliani mechvel at botik.ru
Tue Nov 14 07:10:34 EST 2006

More about finding the source of  fromJust Nothing.

For                  g n = fromJust $ f n, 
ghc-6.6  often looses the reference to  f  in its run-time error 
report -- when  f  returns  Nothing.
And this is difficult to locate the source.
But one could write 
                     g n = let  Just m = f n  in  m,
for which GHC reports 
              Main: M1.hs:9:11-22: 
              Irrefutable pattern failed for pattern Data.Maybe.Just m
-- it points to the source line!

Serge Mechveliani
mechvel at botik.ru

More information about the Glasgow-haskell-users mailing list