hindent
hindent copied to clipboard
Consider using `ghc-lib-parser` instead of `haskell-src-exts`
Completed checklist
- [x] I've checked the issue tracker for similar issues.
- [x] I am not creating an issue about adding more configuration options for the styling/layout of hindent, because hindent is not about customizing style.
Problem description
haskell-src-exts
does not implement some extensions, and unfortunately, it does not seem to be maintained.
For example, we cannot use hindent
with the OverloadedRecordDot
extension.
hindent app/Lib.hs
with this .hindent.yaml
cannot convert the following code.
{-# LANGUAGE OverloadedRecordDot #-}
data Rectangle =
Rectangle
{ width :: Int
, height :: Int
}
area :: Rectangle -> Int
area r = r.width * r.height
extensions:
- OverloadedRecordDot
% hindent app/Lib.hs
hindent: AesonException "Error in $: Unknown extension: OverloadedRecordDot"
CallStack (from HasCallStack):
error, called at src/main/Main.hs:88:19 in main:Main
KnownExtension
lacks the extension.
Proposed solution
I think that replacing haskell-src-exts
with ghc-lib-parser
is one of the options to solve the problem. It is maintained, and other projects (e.g., hlint
and stylish-haskell
) use it. Also, haskell-src-exts
' readme suggests the use of it.
Alternatives
Taking over the maintenance of the library is another option.
Interesting. I was a little bit out of the loop, but I think it is a good idea.
I'm currently rewriting hindent
with ghc-lib-parser
. Once I complete it, I'll submit a PR.
Awesome. Please CC me on the PR so it raises to the top of my notifications.
Thank you for working on it!