-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Template Haskell Splice from readme $$(discover) not working in literate Haskell #539
Comments
Thank you for reporting this. The issue is that ghci runs in interpreted mode, which doesn't support TH splices like To fix this, perhaps you need to enable object code compilation in ghci so that TH can execute properly: stack ghci --ghc-options -fobject-code Or, if you're already in ghci, set the flag and reload: :set -fobject-code
:reload This tells ghci to compile modules to object code, allowing. After that, your |
Thank you very much for your response. The TH splice still does not work with the options you gave on my setup but I just discovered some outdated libraries in my system. I will clean up my setup and report back once I definitively know whether the options you gave work. |
I am now confident, that the options you provided are loaded on my setup (ghci creates .o files) but the TH splice continues not discovering the tests. |
This scenario starts to look like this GHC stage restriction post. When you use a TH splice like The Could you try splitting your code into two modules?
(Make sure |
I have tried to use hedgehog for a tiny bit of property-based testing in
stack ghci
as described in your README.If I define the
tests :: IO Bool
manually, the test is correctly run andfails if I deliberately make it fail by, say, adding 1 on one side of
the equation of
prop_crossSum
.test-manual.lhs
However, I find the explicit enumeration of tests somewhat inelegant,
since I might forget to register a test for a different piece of code.
Your README provides a handy solution using template Haskell, to match
all functions named with the prefix
prop_
with$$(discover)
.However, trying this creates a function
tests
, which still passes butno longer fails when I deliberately make prop_crossSum fail.
test-template.lhs
Is this an issue of your README or of my understanding?
How would I make template haskell recognize
prop_crossSum
or anyother
prop_*
correctly?(Sorry if this does not conform to your convention - this is my first issue)
The text was updated successfully, but these errors were encountered: