haskell / haskell/stylish-haskell

ParseFailed on {-# LANGUAGE

Open
#41 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
1k
Forks
153
PR merge metrics
No merged PRs in 30d

Description

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

source:

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

output

``` shell
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 = ".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 https://github.com/jaspervdj/stylish-haskell/commit/3598ec21fbd215350940ae064c38f0c756cef916

Also maybe this issue should be merged with https://github.com/jaspervdj/stylish-haskell/issues/3

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at Language.Haskell.Stylish.Parse.parseModule and reproduce the failure with the UTF-8-with-BOM Google.hs example from the issue. Compare it with the same file converted to UTF-8 without a BOM and review the linked commit about BOM handling. Done means the command parses the original file successfully without the ParseFailed error.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.