-
Notifications
You must be signed in to change notification settings - Fork 322
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
Refactor to localize/minimize CPP #529
Comments
at least template-haskell stuff could stay in |
Sounds good, TH CPP can be pretty hard to pull out IME. |
@phadej If I can get some guidance on how to approach this, I'd like to also tackle this |
@lorenzo what are the files which are problematic for hindent, let's start with them. I'm also on FreeNode, feel free to |
The list is not too large:
There are only 3 files there that are not related to this issue (those there the error reason shows an operator name) |
seems to fail on the row after |
That's correct, after removing that it fails at another CPP tag. |
When removing the includes in data CoerceText a where
#if HAS_COERCIBLE
CoerceText :: Coercible Text a => CoerceText a
#else
CoerceText :: CoerceText a
#endif In that case we could do (EDIT: hopefully it doesn't obfuscate the use-sites too much!) #if HAS_COERCIBLE
#define CoercibleConstraint(a,b) Coercible a b =>
#else
#define CoercibleConstraint(a,b)
#endif
data CoerceText a where
CoerceText :: CoercibleConstraint(Text,a) CoerceText a That seems to work:
In other words, the trick is to make |
For It might be a blocker to proceed with hindent task in |
@lorenzo heads-up: if you install hindent from my branch: mihaimaruseac/hindent#431 then it should handle |
@phadej is there a decision on changing the CPP declarations the way you showed earlier? |
How about this? Would it cause more duplication elsewhere? #if HAS_COERCIBLE
data CoerceText a where
CoerceText :: Coercible Text a => CoerceText a
#else
data CoerceText a where
CoerceText :: CoerceText a
#endif |
That constraint is repeated multiple times in the file. |
Hmm, am I missing something? But if that's the case then your suggestion sounds good! |
well, I guess, all of these can be repeated. IMHO |
Ideally I'd have one module defining all the CPP, it makes it easier to re-use and removes a lot of noise. This can be done incrementally by moving any of it to a new
Data.Aeson.Compat
module.We probably can't extract everything, but here's the current list of potential suspects:
The text was updated successfully, but these errors were encountered: