Skip to content

ParseFailed on {-# LANGUAGE #41

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

Open
cnd opened this issue Jul 26, 2013 · 5 comments
Open

ParseFailed on {-# LANGUAGE #41

cnd opened this issue Jul 26, 2013 · 5 comments

Comments

@cnd
Copy link

cnd commented Jul 26, 2013

Language.Haskell.Stylish.Parse.parseModule: could not parse Google.hs: ParseFailed (SrcLoc {srcFilen
ame = ".hs", srcLine = 1, srcColumn = 4}) "Parse error: {-# LANGUAGE"

source:

{-# LANGUAGE UnicodeSyntax #-}
module Google
  ( getLastVersionForPlatform
  , getChromium
  ) where

output

D:\Heather\Contrib\haskell\Cr\src>stylish-haskell.exe -vi Google.hs
D:\Heather\Contrib\haskell\Cr\src\.stylish-haskell.yaml exists
Loading configuration at D:\Heather\Contrib\haskell\Cr\src\.stylish-haskell.yaml
Enabled Imports step
Enabled LanguagePragmas step
Enabled Records step
Enabled TrailingWhitespace step
Extra language extensions: []
Language.Haskell.Stylish.Parse.parseModule: could not parse Google.hs: ParseFailed (SrcLoc {srcFilen
ame = "<unknown>.hs", srcLine = 1, srcColumn = 4}) "Parse error: {-# LANGUAGE"

file was UTF-8

Converted to UTF-8 without BOM, now works...

I'm not sure if that should already works on UTF8 with bom according this commit 3598ec2

Also maybe this issue should be merged with #3

@jaspervdj
Copy link
Member

Would it be possible to send me the exact file which fails?

@cnd
Copy link
Author

cnd commented Aug 3, 2013

@jaspervdj
Copy link
Member

Was able to reproduce the error and I think I fixed it. Would you be willing to try out stylish-haskell-0.5.7.0, which I just uploaded to Hackage?

@cnd
Copy link
Author

cnd commented Aug 3, 2013

Okay, thank you, some later.

@danbst
Copy link
Contributor

danbst commented May 1, 2014

The reason this could happen was not correct BOM skipping when reading file in ASCII mode on Windows. Though, reading in UTF must solve that

dropBom ('\xfeff' : str) = str
dropBom str              = str

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants