Template Haskell
mze at informatik.uni-kiel.de
mze at informatik.uni-kiel.de
Wed Mar 15 07:33:14 EST 2006
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
More information about the Glasgow-haskell-bugs
mailing list