fromJust Nothing problem

Serge D. Mechveliani mechvel at botik.ru
Tue Nov 14 05:57:07 EST 2006


Thanks to people who discussed the question of 
"who said `fromJust Nothing'"  and  -xc  option.

My last impression is that instead of using  -xc  it is better to write 
programs in a debug-friendly style. For example, let  g x  must
return (Just _), but the programmer is not 100% sure that  g x  is free
of bugs. Then, instead of
                          f x = h $ fromJust $ g x
one needs too write

  f x = case  g x
        of
        Just y -> h y
        _      -> error $ concat 
                  ["Foo.f ", shows x "\n:\nImpossible happened:\n",
                   "g ", shows x " = Nothing.\n"
                  ]

-----------------
Serge Mechveliani
mechvel at botik.ru






More information about the Glasgow-haskell-users mailing list