mihaimaruseac / hindent

Haskell pretty printer
Other
561 stars 113 forks source link

List comprehension and QuasiQuotes #180

Closed gracjan closed 8 years ago

gracjan commented 8 years ago

When QuasiQuotes are enabled list comprehension may cause parsing error:

GHCi, version 7.10.2: http://www.haskell.org/ghc/  :? for help
Prelude> :set -XQuasiQuotes 
Prelude> let x = [ v | v <- [1,2,3]]
Prelude> let x = [v| v <- [1,2,3]]
<interactive>:4:12: unterminated quasiquotation at end of input
Prelude> 

The ambiguity is documented in GHC ticket 11679.

Running hindent on TemplateHaskell heavy code like Yesod triggers this problem. Workaround seems to be to add a space before or after the list comprehension variable.

chrisdone commented 8 years ago

Indeed, having to add a space is a bit annoying. It's the same for structured-haskell-mode. But at least it's a workaround.