logo       

Re: the impossible happened: msg#00107

lang.haskell.glasgow.bugs

Subject: Re: the impossible happened

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


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise