
On 2006-11-14 at 13:57+0300 "Serge D. Mechveliani" wrote:
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" ]
wouldn't f x = maybe mistake h (g x) where mistake = error $ ("Foo.f "++). shows x. (":\nThis shouldn't happen:\ng "++). shows x $ " = Nothing.\n" be slightly tidier? Jón -- Jón Fairbairn Jon.Fairbairn at cl.cam.ac.uk