the impossible happened
Donald Bruce Stewart
dons at cse.unsw.edu.au
Mon May 23 08:06:08 EDT 2005
bulatz:
> also it will be cool to have ability to add such annotations to my own
> functions, smthg like:
>
> head (x:xs) = x
> head [] = superError "head []"
>
> which will print: "Error: head [] in Module.hs:155"
You can do this already with GHC.Base.assert (almost):
> import GHC.Base (assert)
>
> f [] = assert False ()
> f x = ()
*Main> f [1,2]
()
*Main> f []
*** Exception: t.hs:3:7-12: Assertion failed
At least you can get the line number.
-- Don
More information about the Glasgow-haskell-bugs
mailing list