Skip to content

Implement support for Cabal CPP pragmas #255

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

Closed
lykahb opened this issue Mar 24, 2014 · 8 comments
Closed

Implement support for Cabal CPP pragmas #255

lykahb opened this issue Mar 24, 2014 · 8 comments

Comments

@lykahb
Copy link

lykahb commented Mar 24, 2014

When a file has a pragma with Cabal macros like

#if MIN_VERSION_template_haskell(2, 7, 0)

it would not loaded by the inferior haskell process because of

error: missing binary operator before token "("
phase `C pre-processor' failed (exitcode = 1)

I suggest detecting this error message and issuing a command :set -optP-include -optPdist/build/autogen/cabal_macros.h as pointed out at http://stackoverflow.com/questions/12546757/how-do-i-use-cabals-min-version-and-other-macros-with-ghci

If the header file is absent, haskell-mode can run a cabal build.

@chrisdone
Copy link
Member

Agree. Technically cabal repl deals with this issue. But if one is unable to use cabal repl such a detection would be handy.

@hvr
Copy link
Member

hvr commented Mar 24, 2014

injecting a :set is the wrong approach here IMO; cabal repl support is what we want here

@chrisdone
Copy link
Member

Another trick is putting this in your .ghci file of your project so that you only have to do this once.

@lykahb
Copy link
Author

lykahb commented Mar 24, 2014

How can I detect if ghci or cabal repl was used?

@chrisdone
Copy link
Member

How are you running GHCi?

@lykahb
Copy link
Author

lykahb commented Mar 24, 2014

It is started by inferior-haskell I guess. I haven't used ghci for the modules which haskell-mode did not load.

@gracjan
Copy link
Contributor

gracjan commented Mar 27, 2015

It has been over a ear since this issue was reported. It seems that todays cabal repl covers all use cases. Is this issue still relevant?

@gracjan
Copy link
Contributor

gracjan commented Apr 6, 2015

I'll close this now. If you feel this is important just write below and we will reopen.

@gracjan gracjan closed this as completed Apr 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants