logo       

Template Haskell: msg#00106

lang.haskell.glasgow.bugs

Subject: Template Haskell

Hi,

i've got a problem with the function recover in Template Haskell:

I'd like to check, if a function is already implemented. My idea is to
call reify with the functionname. But reify throws an error if the name is
not in scope. So I wanted to use "recover", but it doesn't work like
expected:

y = $(recover (return (LitE (IntegerL 1)))
(reify (mkName ("ola")) >> return (LitE (IntegerL 2))))

The compilation failed: `ola' is not in scope at a reify
In the definition of `y'
I thought the value of y would be 1, if "ola" is not in scope and 2
otherwise.


And even this doesn't work (the compilation failed):

x = $(recover (return (LitE (IntegerL 1)))
(report True "error" >> return (LitE (IntegerL 2))))


Is there a bug in recover?

Melanie Bargstädt


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

News | FAQ | advertise