
On Tue, Nov 14, 2006 at 12:08:07PM +0000, Jon Fairbairn wrote:
[..] 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?
1) I do not see why the latter is tidier. It uses two extra functions. 2) By "needs to write" I meant "needs to write something like". ----------------- Serge Mechveliani mechvel@botik.ru