Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Define "__GHCIDE__" on CPP #264

Merged
merged 1 commit into from
Dec 17, 2019
Merged

Conversation

serras
Copy link
Contributor

@serras serras commented Dec 16, 2019

This patch comes from my experience in using ghcide in combination with quasi-quoters which read from files. If you have something like:

$(doSomething "from.file")

then build tools would take the relative path to start with the source folder of the corresponding project, but ghcide takes it from the root of the project. Until a better solution is found, my proposal is to have this additional define in CPP, so we can do:

#if __GHCIDE__
$(doSomething "src/from.file")
#else
$(doSomething "from.file")
#endif

@cocreature
Copy link
Collaborator

Do you have an idea of how hard it would be to fix this properly? I would very much like to avoid adding more GHCIDE specific hacks and rather invest into making sure that we agree with GHC.

@serras
Copy link
Contributor Author

serras commented Dec 16, 2019

My gut feeling is that once we have multi-cradle support from hie-bios, we should be able to configure it there.

@ndmitchell
Copy link
Collaborator

I think it's pretty reasonable to have a macro for ghcide. It's standard practice for most tools - eg HLint defines one. Would be great if no one ever needed it, but that's probably unrealistic.

@cocreature
Copy link
Collaborator

HLint doesn’t try to be a Haskell compiler so I don’t think this is a fair comparison. That said, I tend to agree that this macro is reasonable so let’s merge this for now.

@cocreature cocreature merged commit a698a6f into haskell:master Dec 17, 2019
pepeiborra pushed a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
pepeiborra pushed a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
pepeiborra pushed a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants