brittany often fails on files with TemplateHaskell #206
Labels
No Label
blocked: dependency
blocked: info-needed
bug
duplicate
enhancement
fixed in HEAD
help wanted
hs:arrows
hs:brackets
hs:classes
hs:comments
hs:do-notation
hs:guards
hs:lists
hs:operators
hs:patterns
hs:records
hs:types
invalid
language extension support
layouting
needs confirmation
priority: high
priority: low
question
revisit before next release
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: hexagoxel/brittany#206
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
Unfortunately I don't know exactly what's causing it because it doesn't seem to fails on all files which use TemplateHaskell, but it does seem to happen on a lot of them.
On
0d98f92420/persistwrap-table/test/PersistWrap/TableSpec.hs
I get
brittanyCmd: HsSpliceTy{} Brittany error - invalid output
Can you provide a smaller failing example? There's a lot going on in that file. It's not clear what the problem could be.
I got this error whenever brittany puts some template haskell on its own line.
Ex:
gets formatted to
and then whenever I attempt to format, it errors with:
If written so that the TH isn't at the beginning of line, it works fine, so there is a work around.
I can reproduce this as well with a slightly different example:
gives this error:
If the quasiquote is on the same line as
foo =
then there is no error.Another example:
Fails
Working
Here's a minimal example:
You can work around this by adding a
-- brittany-disable-next-binding
comment above the troublesome splice.I wasn't able to reproduce the error with quasi quotes.
I'm not exactly sure if it is related or should be spearated issue, but when trying to format:
I'm getting ...
ct $ (em
... which results in broken codeTo fix the
embedFile
problem you need to let Brittany know that theTemplateHaskell
language extension is enabled. You can do that by either adding the{-# LANGUAGE TemplateHaskell #-}
pragma to the file, or calling Brittany with--ghc-options -XTemplateHaskell
.