Open s-and-witch opened 1 year ago
A quick check: do you depend on template-haskell
and haskell-src-meta
versions that support OverloadedRecordDot
extension?
do you depend on
template-haskell
template-haskell
library comes with GHC and definitely supports -XOverloadedRecordDot
and
haskell-src-meta
haskell-src-meta
uses haskell-src-exts
(which is not a Haskell parser) to parse Haskell code. HSE
was not updated since 2020 and cannot support -XOverloadedRecordDot
because GHC 9.2.1 (which introduces -XOverloadedRecordDot
) was released in 29th October 2021.
Ah yeah, haskell-src-exts
rather matters here, and I use it as a parser here.
So, that's unfortunate :thinking: If you can recommend which library to use for parsing Haskell, that could also account for the currently enabled extensions (till now I obtained them from TH context), that would be a good starting point for the fix.
I don't know such libraries.
I'm scary that we would have to come with GHC proposal that will expose parsing API, because GHC seems to be the only way to parse GHC/Haskell and depending on the whole ghc-lib
is too excessive for just a library for interpolation.
Yeeah
Description
Attempt to use
-XOverloadedRecordDot
inside the interpolation would cause an error, becausefoo.bar
is parsed asfoo . bar
To Reproduce
This would cause an error:
If you try to remove
-XNoFieldSelectors
, then there would be an error about types mismatchExpected behavior
Successful compilation, like in
foo x = let f = x.field in [int|| X is #{f} |]